visualruby 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,101 @@
|
|
|
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="window_position">center-always</property>
|
|
9
|
+
<signal name="destroy" handler="destroy_window" swapped="no"/>
|
|
10
|
+
<child>
|
|
11
|
+
<object class="GtkHBox" id="hbox1">
|
|
12
|
+
<property name="visible">True</property>
|
|
13
|
+
<property name="can_focus">False</property>
|
|
14
|
+
<child>
|
|
15
|
+
<object class="GtkVBox" id="vbox1">
|
|
16
|
+
<property name="visible">True</property>
|
|
17
|
+
<property name="can_focus">False</property>
|
|
18
|
+
<child>
|
|
19
|
+
<object class="GtkLabel" id="label1">
|
|
20
|
+
<property name="visible">True</property>
|
|
21
|
+
<property name="can_focus">False</property>
|
|
22
|
+
<property name="xpad">10</property>
|
|
23
|
+
<property name="ypad">10</property>
|
|
24
|
+
<property name="label" translatable="yes">Open as many child windows as you want.
|
|
25
|
+
You can switch between windows because they're not modal.
|
|
26
|
+
Then click the close button, to close everything.</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="GtkHButtonBox" id="hbuttonbox1">
|
|
37
|
+
<property name="visible">True</property>
|
|
38
|
+
<property name="can_focus">False</property>
|
|
39
|
+
<property name="spacing">10</property>
|
|
40
|
+
<child>
|
|
41
|
+
<object class="GtkButton" id="buttonOpenChild">
|
|
42
|
+
<property name="label" translatable="yes">Open Non-Modal Window</property>
|
|
43
|
+
<property name="visible">True</property>
|
|
44
|
+
<property name="can_focus">True</property>
|
|
45
|
+
<property name="receives_default">True</property>
|
|
46
|
+
<property name="use_action_appearance">False</property>
|
|
47
|
+
</object>
|
|
48
|
+
<packing>
|
|
49
|
+
<property name="expand">False</property>
|
|
50
|
+
<property name="fill">False</property>
|
|
51
|
+
<property name="position">0</property>
|
|
52
|
+
</packing>
|
|
53
|
+
</child>
|
|
54
|
+
<child>
|
|
55
|
+
<object class="GtkButton" id="modalButton">
|
|
56
|
+
<property name="label" translatable="yes">Open Modal Window</property>
|
|
57
|
+
<property name="visible">True</property>
|
|
58
|
+
<property name="can_focus">True</property>
|
|
59
|
+
<property name="receives_default">True</property>
|
|
60
|
+
<property name="use_action_appearance">False</property>
|
|
61
|
+
</object>
|
|
62
|
+
<packing>
|
|
63
|
+
<property name="expand">False</property>
|
|
64
|
+
<property name="fill">False</property>
|
|
65
|
+
<property name="position">1</property>
|
|
66
|
+
</packing>
|
|
67
|
+
</child>
|
|
68
|
+
<child>
|
|
69
|
+
<object class="GtkButton" id="cancelButton">
|
|
70
|
+
<property name="label" translatable="yes">Cancel</property>
|
|
71
|
+
<property name="visible">True</property>
|
|
72
|
+
<property name="can_focus">True</property>
|
|
73
|
+
<property name="receives_default">True</property>
|
|
74
|
+
<property name="use_action_appearance">False</property>
|
|
75
|
+
</object>
|
|
76
|
+
<packing>
|
|
77
|
+
<property name="expand">False</property>
|
|
78
|
+
<property name="fill">False</property>
|
|
79
|
+
<property name="position">2</property>
|
|
80
|
+
</packing>
|
|
81
|
+
</child>
|
|
82
|
+
</object>
|
|
83
|
+
<packing>
|
|
84
|
+
<property name="expand">True</property>
|
|
85
|
+
<property name="fill">True</property>
|
|
86
|
+
<property name="padding">10</property>
|
|
87
|
+
<property name="position">1</property>
|
|
88
|
+
</packing>
|
|
89
|
+
</child>
|
|
90
|
+
</object>
|
|
91
|
+
<packing>
|
|
92
|
+
<property name="expand">True</property>
|
|
93
|
+
<property name="fill">True</property>
|
|
94
|
+
<property name="padding">20</property>
|
|
95
|
+
<property name="position">0</property>
|
|
96
|
+
</packing>
|
|
97
|
+
</child>
|
|
98
|
+
</object>
|
|
99
|
+
</child>
|
|
100
|
+
</object>
|
|
101
|
+
</interface>
|
|
@@ -0,0 +1,58 @@
|
|
|
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">Title</property>
|
|
9
|
+
<property name="modal">True</property>
|
|
10
|
+
<signal name="destroy" handler="destroy_window" swapped="no"/>
|
|
11
|
+
<child>
|
|
12
|
+
<object class="GtkVBox" id="vbox1">
|
|
13
|
+
<property name="visible">True</property>
|
|
14
|
+
<property name="can_focus">False</property>
|
|
15
|
+
<child>
|
|
16
|
+
<object class="GtkLabel" id="MyChildClass.hello">
|
|
17
|
+
<property name="visible">True</property>
|
|
18
|
+
<property name="can_focus">False</property>
|
|
19
|
+
<property name="xpad">80</property>
|
|
20
|
+
<property name="ypad">20</property>
|
|
21
|
+
<property name="label" translatable="yes">label</property>
|
|
22
|
+
</object>
|
|
23
|
+
<packing>
|
|
24
|
+
<property name="expand">True</property>
|
|
25
|
+
<property name="fill">True</property>
|
|
26
|
+
<property name="position">0</property>
|
|
27
|
+
</packing>
|
|
28
|
+
</child>
|
|
29
|
+
<child>
|
|
30
|
+
<object class="GtkHButtonBox" id="hbuttonbox1">
|
|
31
|
+
<property name="visible">True</property>
|
|
32
|
+
<property name="can_focus">False</property>
|
|
33
|
+
<child>
|
|
34
|
+
<object class="GtkButton" id="buttonCancel">
|
|
35
|
+
<property name="label" translatable="yes">Cancel</property>
|
|
36
|
+
<property name="visible">True</property>
|
|
37
|
+
<property name="can_focus">True</property>
|
|
38
|
+
<property name="receives_default">True</property>
|
|
39
|
+
<property name="use_action_appearance">False</property>
|
|
40
|
+
</object>
|
|
41
|
+
<packing>
|
|
42
|
+
<property name="expand">False</property>
|
|
43
|
+
<property name="fill">False</property>
|
|
44
|
+
<property name="position">0</property>
|
|
45
|
+
</packing>
|
|
46
|
+
</child>
|
|
47
|
+
</object>
|
|
48
|
+
<packing>
|
|
49
|
+
<property name="expand">True</property>
|
|
50
|
+
<property name="fill">True</property>
|
|
51
|
+
<property name="padding">10</property>
|
|
52
|
+
<property name="position">1</property>
|
|
53
|
+
</packing>
|
|
54
|
+
</child>
|
|
55
|
+
</object>
|
|
56
|
+
</child>
|
|
57
|
+
</object>
|
|
58
|
+
</interface>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
require 'vrlib'
|
|
4
|
+
|
|
5
|
+
#make program output in real time so errors visible in VR.
|
|
6
|
+
STDOUT.sync = true
|
|
7
|
+
STDERR.sync = true
|
|
8
|
+
|
|
9
|
+
my_path = File.expand_path(File.dirname(__FILE__))
|
|
10
|
+
require_all Dir.glob(my_path + "/bin/**/*.rb")
|
|
11
|
+
|
|
12
|
+
ChildWindowDemo.new.show
|
|
13
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
--- !ruby/object:VR_ENV
|
|
2
|
+
backup_path: /home/eric
|
|
3
|
+
browser: firefox
|
|
4
|
+
current_file: /home/eric/vrp/vrx/visualruby_examples/drag_drop/main.rb
|
|
5
|
+
font_name: Monospace 10
|
|
6
|
+
glade_path: glade-3
|
|
7
|
+
height: 858
|
|
8
|
+
open_files:
|
|
9
|
+
- /home/eric/vrp/vrx/visualruby_examples/drag_drop/bin/DragDropDemo.rb
|
|
10
|
+
- /home/eric/vrp/vrx/visualruby_examples/drag_drop/main.rb
|
|
11
|
+
open_folders:
|
|
12
|
+
- /home/eric/vrp/vrx/visualruby_examples/drag_drop
|
|
13
|
+
- /home/eric/vrp/vrx/visualruby_examples/drag_drop/bin
|
|
14
|
+
- /home/eric/vrp/vrx/visualruby_examples/drag_drop/bin/glade
|
|
15
|
+
panel_pos: 594
|
|
16
|
+
rdoc_command_line: rdoc -x README
|
|
17
|
+
run_command_line: ruby main.rb
|
|
18
|
+
tab_spaces: 2
|
|
19
|
+
width: 1434
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
class DragDropDemo
|
|
3
|
+
|
|
4
|
+
include GladeGUI
|
|
5
|
+
|
|
6
|
+
def before_show()
|
|
7
|
+
@treeview1 = "I'm a widget named textview2.\n\nTry dragging a file or the button onto me."
|
|
8
|
+
@view = VR::FileTreeView.new("./img")
|
|
9
|
+
@view.refresh()
|
|
10
|
+
@builder["scrolledwindow1"].add(@view)
|
|
11
|
+
@view.drag_to(@builder["textview1"])
|
|
12
|
+
@view.drag_to(@builder["button1"])
|
|
13
|
+
drag_to(@builder["button1"], @builder["textview1"])
|
|
14
|
+
drag_to(@builder["textview1"], @builder["button1"])
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# This executes when button1 receives a widget dropped on it. When the button1 widget
|
|
19
|
+
# receives a drag_drop signal, an instance variable named dragged_widget is set automatically set
|
|
20
|
+
# by visualruby containing a reference to the dragged widget:
|
|
21
|
+
|
|
22
|
+
def button1__drag_drop(*args)
|
|
23
|
+
but1 = @builder["button1"]
|
|
24
|
+
if but1.dragged_widget.is_a?(Gtk::TextView)
|
|
25
|
+
but1.label = but1.dragged_widget.buffer.text.slice(0,15)
|
|
26
|
+
elsif but1.dragged_widget.is_a?(VR::FileTreeView)
|
|
27
|
+
but1.label = @view.get_selected_path()
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def textview1__drag_drop(*args)
|
|
32
|
+
tv1 = @builder["textview1"]
|
|
33
|
+
if tv1.dragged_widget == @view
|
|
34
|
+
path = @view.get_selected_path()
|
|
35
|
+
tv1.buffer.text = File.directory?(path) ? path : File.read(path)
|
|
36
|
+
elsif tv1.dragged_widget.is_a?(Gtk::Button)
|
|
37
|
+
tv1.buffer.text = tv1.dragged_widget.label
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
@@ -0,0 +1,143 @@
|
|
|
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="width_request">800</property>
|
|
7
|
+
<property name="height_request">400</property>
|
|
8
|
+
<property name="visible">True</property>
|
|
9
|
+
<property name="title" translatable="yes">Drag N Drop -- Visualruby</property>
|
|
10
|
+
<property name="modal">True</property>
|
|
11
|
+
<property name="window_position">center-always</property>
|
|
12
|
+
<signal name="destroy" handler="destroy_window"/>
|
|
13
|
+
<child>
|
|
14
|
+
<object class="GtkVBox" id="vbox1">
|
|
15
|
+
<property name="visible">True</property>
|
|
16
|
+
<child>
|
|
17
|
+
<object class="GtkHBox" id="hbox2">
|
|
18
|
+
<property name="visible">True</property>
|
|
19
|
+
<child>
|
|
20
|
+
<object class="GtkVBox" id="vbox2">
|
|
21
|
+
<property name="visible">True</property>
|
|
22
|
+
<property name="spacing">10</property>
|
|
23
|
+
<child>
|
|
24
|
+
<object class="GtkFrame" id="frame1">
|
|
25
|
+
<property name="width_request">520</property>
|
|
26
|
+
<property name="visible">True</property>
|
|
27
|
+
<property name="label_xalign">0</property>
|
|
28
|
+
<property name="shadow_type">in</property>
|
|
29
|
+
<child>
|
|
30
|
+
<object class="GtkAlignment" id="alignment1">
|
|
31
|
+
<property name="visible">True</property>
|
|
32
|
+
<property name="top_padding">12</property>
|
|
33
|
+
<property name="bottom_padding">13</property>
|
|
34
|
+
<property name="left_padding">13</property>
|
|
35
|
+
<property name="right_padding">13</property>
|
|
36
|
+
<child>
|
|
37
|
+
<object class="GtkLabel" id="label2">
|
|
38
|
+
<property name="width_request">600</property>
|
|
39
|
+
<property name="visible">True</property>
|
|
40
|
+
<property name="xalign">0</property>
|
|
41
|
+
<property name="yalign">0</property>
|
|
42
|
+
<property name="label" translatable="yes">With visualruby, you can drag-n-drop any widget onto another widget. Try dragging files or the button onto the textview in the middle of the screen. Also, try dragging between the textview and the button.</property>
|
|
43
|
+
<property name="wrap">True</property>
|
|
44
|
+
</object>
|
|
45
|
+
</child>
|
|
46
|
+
</object>
|
|
47
|
+
</child>
|
|
48
|
+
<child type="label">
|
|
49
|
+
<object class="GtkLabel" id="label1">
|
|
50
|
+
<property name="visible">True</property>
|
|
51
|
+
<property name="label" translatable="yes"><b>Instructions</b></property>
|
|
52
|
+
<property name="use_markup">True</property>
|
|
53
|
+
</object>
|
|
54
|
+
</child>
|
|
55
|
+
</object>
|
|
56
|
+
<packing>
|
|
57
|
+
<property name="expand">False</property>
|
|
58
|
+
<property name="fill">False</property>
|
|
59
|
+
<property name="padding">5</property>
|
|
60
|
+
<property name="position">0</property>
|
|
61
|
+
</packing>
|
|
62
|
+
</child>
|
|
63
|
+
<child>
|
|
64
|
+
<object class="GtkHBox" id="hbox3">
|
|
65
|
+
<property name="visible">True</property>
|
|
66
|
+
<property name="spacing">10</property>
|
|
67
|
+
<child>
|
|
68
|
+
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
|
69
|
+
<property name="visible">True</property>
|
|
70
|
+
<property name="can_focus">True</property>
|
|
71
|
+
<property name="hscrollbar_policy">automatic</property>
|
|
72
|
+
<property name="vscrollbar_policy">automatic</property>
|
|
73
|
+
<child>
|
|
74
|
+
<placeholder/>
|
|
75
|
+
</child>
|
|
76
|
+
</object>
|
|
77
|
+
<packing>
|
|
78
|
+
<property name="position">0</property>
|
|
79
|
+
</packing>
|
|
80
|
+
</child>
|
|
81
|
+
<child>
|
|
82
|
+
<object class="GtkScrolledWindow" id="scrolledwindow2">
|
|
83
|
+
<property name="visible">True</property>
|
|
84
|
+
<property name="can_focus">True</property>
|
|
85
|
+
<property name="hscrollbar_policy">automatic</property>
|
|
86
|
+
<property name="vscrollbar_policy">automatic</property>
|
|
87
|
+
<child>
|
|
88
|
+
<object class="GtkTextView" id="textview1">
|
|
89
|
+
<property name="visible">True</property>
|
|
90
|
+
<property name="can_focus">True</property>
|
|
91
|
+
</object>
|
|
92
|
+
</child>
|
|
93
|
+
</object>
|
|
94
|
+
<packing>
|
|
95
|
+
<property name="position">1</property>
|
|
96
|
+
</packing>
|
|
97
|
+
</child>
|
|
98
|
+
<child>
|
|
99
|
+
<object class="GtkVButtonBox" id="vbuttonbox1">
|
|
100
|
+
<property name="visible">True</property>
|
|
101
|
+
<property name="spacing">3</property>
|
|
102
|
+
<property name="layout_style">end</property>
|
|
103
|
+
<child>
|
|
104
|
+
<object class="GtkButton" id="button1">
|
|
105
|
+
<property name="label" translatable="yes">button1</property>
|
|
106
|
+
<property name="visible">True</property>
|
|
107
|
+
<property name="can_focus">True</property>
|
|
108
|
+
<property name="receives_default">True</property>
|
|
109
|
+
</object>
|
|
110
|
+
<packing>
|
|
111
|
+
<property name="expand">False</property>
|
|
112
|
+
<property name="fill">False</property>
|
|
113
|
+
<property name="position">0</property>
|
|
114
|
+
</packing>
|
|
115
|
+
</child>
|
|
116
|
+
</object>
|
|
117
|
+
<packing>
|
|
118
|
+
<property name="expand">False</property>
|
|
119
|
+
<property name="padding">10</property>
|
|
120
|
+
<property name="position">2</property>
|
|
121
|
+
</packing>
|
|
122
|
+
</child>
|
|
123
|
+
</object>
|
|
124
|
+
<packing>
|
|
125
|
+
<property name="position">1</property>
|
|
126
|
+
</packing>
|
|
127
|
+
</child>
|
|
128
|
+
</object>
|
|
129
|
+
<packing>
|
|
130
|
+
<property name="padding">15</property>
|
|
131
|
+
<property name="position">0</property>
|
|
132
|
+
</packing>
|
|
133
|
+
</child>
|
|
134
|
+
</object>
|
|
135
|
+
<packing>
|
|
136
|
+
<property name="padding">15</property>
|
|
137
|
+
<property name="position">0</property>
|
|
138
|
+
</packing>
|
|
139
|
+
</child>
|
|
140
|
+
</object>
|
|
141
|
+
</child>
|
|
142
|
+
</object>
|
|
143
|
+
</interface>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
require 'vrlib'
|
|
4
|
+
|
|
5
|
+
#make program output in real time so errors visible in VR.
|
|
6
|
+
STDOUT.sync = true
|
|
7
|
+
STDERR.sync = true
|
|
8
|
+
|
|
9
|
+
#everything in these directories will be included
|
|
10
|
+
my_path = File.expand_path(File.dirname(__FILE__))
|
|
11
|
+
require_all Dir.glob(my_path + "/bin/**/*.rb")
|
|
12
|
+
|
|
13
|
+
DragDropDemo.new.show
|
|
14
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
--- !ruby/object:VR_ENV
|
|
2
|
+
backup_path: /home/eric
|
|
3
|
+
browser: C:\Program Files\iexplorer\iexplore.exe
|
|
4
|
+
current_file: /home/eric/vrp/vrx/visualruby_examples/listview/main.rb
|
|
5
|
+
font_name: Monospace 10
|
|
6
|
+
glade_path: glade-gtk2
|
|
7
|
+
height: 831
|
|
8
|
+
open_files:
|
|
9
|
+
- /home/eric/vrp/vrx/visualruby_examples/listview/bin/SongListView.rb
|
|
10
|
+
- /home/eric/vrp/vrx/visualruby_examples/listview/bin/SongListViewGUI.rb
|
|
11
|
+
- /home/eric/vrp/vrx/visualruby_examples/listview/main.rb
|
|
12
|
+
open_folders:
|
|
13
|
+
- /home/eric/vrp/vrx/visualruby_examples/listview
|
|
14
|
+
- /home/eric/vrp/vrx/visualruby_examples/listview/bin
|
|
15
|
+
- /home/eric/vrp/vrx/visualruby_examples/listview/bin/glade
|
|
16
|
+
panel_pos: 494
|
|
17
|
+
rdoc_command_line: rdoc -x README
|
|
18
|
+
run_command_line: ruby main.rb
|
|
19
|
+
tab_spaces: 2
|
|
20
|
+
width: 1190
|
|
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,89 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This class contains all the code for the ListView itself.
|
|
3
|
+
# It sets-up the columns and data.
|
|
4
|
+
# The GUI class will make changes to the view/data.
|
|
5
|
+
# All the GUI code is in SongListViewGUI.rb.
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
class SongListView < VR::ListView
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
AUDIO_ICON = Gdk::Pixbuf.new(File.dirname(__FILE__) + "/audio-x-generic.png")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def initialize
|
|
15
|
+
@cols = {}
|
|
16
|
+
@cols[:pix] = {:pix => Gdk::Pixbuf, :song => String } #two renderers in this column
|
|
17
|
+
@cols[:date] = DateTime
|
|
18
|
+
@cols[:artist] = String
|
|
19
|
+
@cols[:first_name] = String
|
|
20
|
+
@cols[:last_name] = String
|
|
21
|
+
@cols[:popular] = VR::ProgressCol
|
|
22
|
+
@cols[:buy] = VR::ComboCol
|
|
23
|
+
@cols[:quantity] = VR::SpinCol
|
|
24
|
+
@cols[:price] = VR::CurrencyCol
|
|
25
|
+
@cols[:check] = TrueClass
|
|
26
|
+
super(@cols)
|
|
27
|
+
|
|
28
|
+
col_sort_column_id(:artist => id(:last_name), :song => id(:song), :first_name=> id(:first_name))
|
|
29
|
+
col_sort_column_id(:last_name => id(:last_name), :popular => id(:popular), :buy=> id(:buy))
|
|
30
|
+
col_sort_column_id(:quantity => id(:quantity), :price => id(:price), :check => id(:check), :date => id(:date))
|
|
31
|
+
|
|
32
|
+
col_title(:first_name => "First", :last_name => "Last", :quantity => "Qty", :check => "Ok")
|
|
33
|
+
ren_width(:buy => 70, :popular => 80, :quantity => 40)
|
|
34
|
+
ren_attr(:price, :edit_inline => true)
|
|
35
|
+
ren_editable(true)
|
|
36
|
+
|
|
37
|
+
# this block executes after ARTIST is edited ("edited" event).
|
|
38
|
+
renderer(:artist).edited_callback = Proc.new { | model_col, iter |
|
|
39
|
+
names = iter[id(:artist)].split
|
|
40
|
+
iter[id(:first_name)] = names[0]
|
|
41
|
+
iter[id(:last_name)] = names[1]
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
# this block must evaluate to true to allow updating.
|
|
45
|
+
renderer(:artist).validate_block = Proc.new { |text, model_col, iter, view|
|
|
46
|
+
if text.split.size == 2 # insist on two names
|
|
47
|
+
true
|
|
48
|
+
else
|
|
49
|
+
VR::Dialog.message_box("You must enter two names.")
|
|
50
|
+
false
|
|
51
|
+
end
|
|
52
|
+
}
|
|
53
|
+
refresh()
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# this just loads the data into the model
|
|
57
|
+
def refresh()
|
|
58
|
+
data = get_data() # returns array of songs
|
|
59
|
+
(0..6).each do |i|
|
|
60
|
+
row = add_row()
|
|
61
|
+
row[:pix] = AUDIO_ICON
|
|
62
|
+
row[:first_name] = data[i][0]
|
|
63
|
+
row[:last_name] = data[i][1]
|
|
64
|
+
row[:artist] = row[:first_name] + " " + row[:last_name]
|
|
65
|
+
row[:song] = data[i][2]
|
|
66
|
+
row[:quantity] = VR::SpinCol.new(0,0,100,1)
|
|
67
|
+
row[:price] = VR::CurrencyCol.new(2.99)
|
|
68
|
+
row[:popular] = data[i][3]
|
|
69
|
+
row[:buy] = VR::ComboCol.new("Buy", "Buy", "Rent", "Listen") # all rows use the same combobox
|
|
70
|
+
row[:check] = false
|
|
71
|
+
row[:date] = data[i][4]
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def get_data
|
|
76
|
+
rows = []
|
|
77
|
+
rows << ["Iggy", "Pop", "I Wanna Be Your Dog", 88, DateTime.new(1981,11,21)]
|
|
78
|
+
rows << ["Joe", "Cocker", "You Are So Beautiful", 91, DateTime.new(1973,12,7)]
|
|
79
|
+
rows << ["Elvis", "Costello", "Pump it Up", 77, DateTime.new(1982, 5, 5)]
|
|
80
|
+
rows << ["Paul", "McCartney", "Silly Love Songs", 69, DateTime.new(1979,7,13)]
|
|
81
|
+
rows << ["Dorothy", "Moore", "Misty Blue", 97, DateTime.new(1981, 1, 14)]
|
|
82
|
+
rows << ["Rod", "Stewart", "Hot Legs", 54, DateTime.new(1982, 9, 27)]
|
|
83
|
+
rows << ["Lionel", "Richie", "Three Times a Lady", 84, DateTime.new(1978, 1, 3)]
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
|
|
2
|
+
class SongListViewGUI < SongListView
|
|
3
|
+
|
|
4
|
+
include GladeGUI
|
|
5
|
+
|
|
6
|
+
def before_show
|
|
7
|
+
@builder["scrolledwindow1"].add(self)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def self__row_activated(*argv)
|
|
11
|
+
return unless rows = selected_rows
|
|
12
|
+
row = rows[0]
|
|
13
|
+
VR::Dialog.message_box("You selected\n#{row[:song]}\nby #{row[:artist]}")
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def invisible__toggled(*argv)
|
|
17
|
+
v = !@builder["invisible"].active?
|
|
18
|
+
col_visible(:last_name => v, :first_name => v )
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def radio__toggled(*argv)
|
|
22
|
+
ren_radio(:check => @builder["radio"].active?)
|
|
23
|
+
each_row { |r| r[:check] = false }
|
|
24
|
+
repaint
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def background__toggled(*argv)
|
|
28
|
+
val = @builder["background"].active? ? "yellow" : "white"
|
|
29
|
+
ren_attr(:song, :background => val) # same as set_background( SONG => val)
|
|
30
|
+
repaint
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def xalign__toggled(*argv)
|
|
34
|
+
val = @builder["xalign"].active? ? 1 : 0
|
|
35
|
+
ren_xalign(:artist => val)
|
|
36
|
+
repaint
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def bold__toggled(*argv)
|
|
40
|
+
val = @builder["bold"].active? ? Pango::WEIGHT_BOLD : Pango::WEIGHT_NORMAL
|
|
41
|
+
ren_weight(:song => val) #number from 100 to 900, BOLD = 700
|
|
42
|
+
repaint
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def center__toggled(*argv)
|
|
46
|
+
val = @builder["center"].active? ? 0.5 : 0
|
|
47
|
+
col_alignment(:artist => val)
|
|
48
|
+
repaint
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def editable__toggled(*argv)
|
|
52
|
+
ren_editable(!@builder["editable"].active?)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def digits__toggled(*argv)
|
|
56
|
+
val = @builder["digits"].active? ? 1 : 0
|
|
57
|
+
ren_digits(:quantity => val)
|
|
58
|
+
repaint
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def repaint
|
|
62
|
+
@builder["scrolledwindow1"].hide
|
|
63
|
+
@builder["window1"].show_all
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
|
|
Binary file
|