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,166 @@
|
|
|
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="window_position">center-always</property>
|
|
8
|
+
<signal name="destroy" handler="destroy_window"/>
|
|
9
|
+
<child>
|
|
10
|
+
<object class="GtkHBox" id="hbox1">
|
|
11
|
+
<property name="visible">True</property>
|
|
12
|
+
<child>
|
|
13
|
+
<object class="GtkVBox" id="vbox2">
|
|
14
|
+
<property name="visible">True</property>
|
|
15
|
+
<property name="spacing">10</property>
|
|
16
|
+
<child>
|
|
17
|
+
<object class="GtkImage" id="image1">
|
|
18
|
+
<property name="width_request">330</property>
|
|
19
|
+
<property name="height_request">200</property>
|
|
20
|
+
<property name="visible">True</property>
|
|
21
|
+
</object>
|
|
22
|
+
<packing>
|
|
23
|
+
<property name="padding">10</property>
|
|
24
|
+
<property name="position">0</property>
|
|
25
|
+
</packing>
|
|
26
|
+
</child>
|
|
27
|
+
<child>
|
|
28
|
+
<object class="GtkLabel" id="label1">
|
|
29
|
+
<property name="visible">True</property>
|
|
30
|
+
<property name="label" translatable="yes">label</property>
|
|
31
|
+
</object>
|
|
32
|
+
<packing>
|
|
33
|
+
<property name="position">1</property>
|
|
34
|
+
</packing>
|
|
35
|
+
</child>
|
|
36
|
+
<child>
|
|
37
|
+
<object class="GtkCheckButton" id="checkbutton1">
|
|
38
|
+
<property name="label" translatable="yes">checkbutton</property>
|
|
39
|
+
<property name="visible">True</property>
|
|
40
|
+
<property name="can_focus">True</property>
|
|
41
|
+
<property name="receives_default">False</property>
|
|
42
|
+
<property name="draw_indicator">True</property>
|
|
43
|
+
</object>
|
|
44
|
+
<packing>
|
|
45
|
+
<property name="position">2</property>
|
|
46
|
+
</packing>
|
|
47
|
+
</child>
|
|
48
|
+
<child>
|
|
49
|
+
<object class="GtkSpinButton" id="spinbutton1">
|
|
50
|
+
<property name="visible">True</property>
|
|
51
|
+
<property name="can_focus">True</property>
|
|
52
|
+
<property name="invisible_char">•</property>
|
|
53
|
+
<property name="adjustment">adjustment1</property>
|
|
54
|
+
<property name="climb_rate">0.10000000000000001</property>
|
|
55
|
+
<property name="digits">1</property>
|
|
56
|
+
<property name="numeric">True</property>
|
|
57
|
+
</object>
|
|
58
|
+
<packing>
|
|
59
|
+
<property name="padding">10</property>
|
|
60
|
+
<property name="position">3</property>
|
|
61
|
+
</packing>
|
|
62
|
+
</child>
|
|
63
|
+
<child>
|
|
64
|
+
<object class="GtkLinkButton" id="linkbutton1">
|
|
65
|
+
<property name="label" translatable="yes">button</property>
|
|
66
|
+
<property name="visible">True</property>
|
|
67
|
+
<property name="can_focus">True</property>
|
|
68
|
+
<property name="receives_default">True</property>
|
|
69
|
+
<property name="has_tooltip">True</property>
|
|
70
|
+
<property name="relief">none</property>
|
|
71
|
+
<property name="uri">http://glade.gnome.org</property>
|
|
72
|
+
</object>
|
|
73
|
+
<packing>
|
|
74
|
+
<property name="position">4</property>
|
|
75
|
+
</packing>
|
|
76
|
+
</child>
|
|
77
|
+
<child>
|
|
78
|
+
<object class="GtkEntry" id="entry1">
|
|
79
|
+
<property name="visible">True</property>
|
|
80
|
+
<property name="can_focus">True</property>
|
|
81
|
+
<property name="invisible_char">•</property>
|
|
82
|
+
</object>
|
|
83
|
+
<packing>
|
|
84
|
+
<property name="position">5</property>
|
|
85
|
+
</packing>
|
|
86
|
+
</child>
|
|
87
|
+
<child>
|
|
88
|
+
<object class="GtkProgressBar" id="progressbar1">
|
|
89
|
+
<property name="visible">True</property>
|
|
90
|
+
<property name="fraction">0.080000000000000002</property>
|
|
91
|
+
<property name="text" translatable="yes">I'm a progressbar</property>
|
|
92
|
+
</object>
|
|
93
|
+
<packing>
|
|
94
|
+
<property name="padding">10</property>
|
|
95
|
+
<property name="position">6</property>
|
|
96
|
+
</packing>
|
|
97
|
+
</child>
|
|
98
|
+
</object>
|
|
99
|
+
<packing>
|
|
100
|
+
<property name="padding">10</property>
|
|
101
|
+
<property name="position">0</property>
|
|
102
|
+
</packing>
|
|
103
|
+
</child>
|
|
104
|
+
<child>
|
|
105
|
+
<object class="GtkVBox" id="vbox1">
|
|
106
|
+
<property name="visible">True</property>
|
|
107
|
+
<child>
|
|
108
|
+
<object class="GtkCalendar" id="calendar1">
|
|
109
|
+
<property name="visible">True</property>
|
|
110
|
+
<property name="can_focus">True</property>
|
|
111
|
+
<property name="year">2012</property>
|
|
112
|
+
<property name="month">2</property>
|
|
113
|
+
<property name="day">12</property>
|
|
114
|
+
</object>
|
|
115
|
+
<packing>
|
|
116
|
+
<property name="expand">False</property>
|
|
117
|
+
<property name="fill">False</property>
|
|
118
|
+
<property name="padding">10</property>
|
|
119
|
+
<property name="position">0</property>
|
|
120
|
+
</packing>
|
|
121
|
+
</child>
|
|
122
|
+
<child>
|
|
123
|
+
<object class="GtkHButtonBox" id="hbuttonbox1">
|
|
124
|
+
<property name="visible">True</property>
|
|
125
|
+
<child>
|
|
126
|
+
<object class="GtkFontButton" id="fontbutton1">
|
|
127
|
+
<property name="visible">True</property>
|
|
128
|
+
<property name="can_focus">True</property>
|
|
129
|
+
<property name="receives_default">True</property>
|
|
130
|
+
</object>
|
|
131
|
+
<packing>
|
|
132
|
+
<property name="expand">False</property>
|
|
133
|
+
<property name="fill">False</property>
|
|
134
|
+
<property name="position">0</property>
|
|
135
|
+
</packing>
|
|
136
|
+
</child>
|
|
137
|
+
</object>
|
|
138
|
+
<packing>
|
|
139
|
+
<property name="position">1</property>
|
|
140
|
+
</packing>
|
|
141
|
+
</child>
|
|
142
|
+
<child>
|
|
143
|
+
<object class="GtkTextView" id="textview1">
|
|
144
|
+
<property name="height_request">80</property>
|
|
145
|
+
<property name="visible">True</property>
|
|
146
|
+
<property name="can_focus">True</property>
|
|
147
|
+
</object>
|
|
148
|
+
<packing>
|
|
149
|
+
<property name="padding">10</property>
|
|
150
|
+
<property name="position">2</property>
|
|
151
|
+
</packing>
|
|
152
|
+
</child>
|
|
153
|
+
</object>
|
|
154
|
+
<packing>
|
|
155
|
+
<property name="padding">10</property>
|
|
156
|
+
<property name="position">1</property>
|
|
157
|
+
</packing>
|
|
158
|
+
</child>
|
|
159
|
+
</object>
|
|
160
|
+
</child>
|
|
161
|
+
</object>
|
|
162
|
+
<object class="GtkAdjustment" id="adjustment1">
|
|
163
|
+
<property name="upper">100</property>
|
|
164
|
+
<property name="step_increment">0.10000000000000001</property>
|
|
165
|
+
</object>
|
|
166
|
+
</interface>
|
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
--- !ruby/object:VR_ENV
|
|
2
|
+
backup_path: /home/eric
|
|
3
|
+
browser: firefox
|
|
4
|
+
current_file: /home/eric/vrp/vrx/visualruby_examples/calculator/main.rb
|
|
5
|
+
font_name: Monospace 10
|
|
6
|
+
glade_path: glade-3
|
|
7
|
+
height: 600
|
|
8
|
+
open_files:
|
|
9
|
+
- /home/eric/vrp/vrx/visualruby_examples/calculator/main.rb
|
|
10
|
+
- /home/eric/vrp/vrx/visualruby_examples/calculator/bin/Calculator.rb
|
|
11
|
+
open_folders:
|
|
12
|
+
- /home/eric/vrp/vrx/visualruby_examples/calculator
|
|
13
|
+
- /home/eric/vrp/vrx/visualruby_examples/calculator/bin
|
|
14
|
+
panel_pos: 360
|
|
15
|
+
rdoc_command_line: rdoc -x README
|
|
16
|
+
run_command_line: ruby main.rb
|
|
17
|
+
tab_spaces: 2
|
|
18
|
+
width: 800
|
|
19
|
+
builder: !ruby/object:Gtk::Builder {}
|
|
20
|
+
glade_box: !ruby/object:VR::SimpleComboBoxEntry {}
|
|
21
|
+
browser_box: !ruby/object:VR::SimpleComboBoxEntry {}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This class is a GUI for a calculator. The show() method
|
|
3
|
+
# loads the Calculator.glade file using the line:
|
|
4
|
+
#
|
|
5
|
+
# load_glade(__FILE__)
|
|
6
|
+
#
|
|
7
|
+
# The instance variable, @builder is a reference to the
|
|
8
|
+
# Gtk::Builder object. @builder["window1"] is a reference to
|
|
9
|
+
# the main window of the calculator. So, if you edit
|
|
10
|
+
# the Calculator.glade file (using glade) you'll see that
|
|
11
|
+
# the top window is named "window1." (Always keep the name
|
|
12
|
+
# "window1"!)
|
|
13
|
+
#
|
|
14
|
+
# In glade, you'll see that the names of the keys are:
|
|
15
|
+
#
|
|
16
|
+
# Calculator.keys[0]
|
|
17
|
+
# Calculator.keys[1] ...etc.
|
|
18
|
+
#
|
|
19
|
+
# This corresponds to the array @keys. Visual Ruby's library
|
|
20
|
+
# will automatically load the values of the array into the
|
|
21
|
+
# glade form using this line:
|
|
22
|
+
#
|
|
23
|
+
# set_glade_variables(self)
|
|
24
|
+
#
|
|
25
|
+
# This line causes GladeGUI to search all the instance variables
|
|
26
|
+
# and fill-in widgets that match the vaiable names.
|
|
27
|
+
#
|
|
28
|
+
|
|
29
|
+
class Calculator
|
|
30
|
+
|
|
31
|
+
include GladeGUI
|
|
32
|
+
|
|
33
|
+
def before_show()
|
|
34
|
+
@builder["window1"].title = "Calculator"
|
|
35
|
+
@keys = [ 1, 2, 3, "C" ] +
|
|
36
|
+
[ 4, 5, 6, "+" ] +
|
|
37
|
+
[ 7, 8, 9, "-" ] +
|
|
38
|
+
[ 0, ".","/","=" ]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# This method is called when a key is clicked. It follows
|
|
42
|
+
# this naming convention: <glade_name>__<signal_name>. (Separator is
|
|
43
|
+
# two underscores. This tells GladeGUI to connect all the
|
|
44
|
+
# "clicked" signals to this method. It matches the glade
|
|
45
|
+
# names "keys", "keys[x]" or "Calculator.keys[x]" to this method
|
|
46
|
+
# automatically for all the buttons. Look at the names
|
|
47
|
+
# of the keys in glade by right clicking on Calculator.rb
|
|
48
|
+
|
|
49
|
+
def keys__clicked(button)
|
|
50
|
+
case button.label
|
|
51
|
+
when "C" then @builder["display"].text = ""
|
|
52
|
+
when "=" then
|
|
53
|
+
begin # this doesn't catch all errors
|
|
54
|
+
@builder["display.text"] = eval(@builder["display"].text).to_s
|
|
55
|
+
rescue
|
|
56
|
+
@builder["display.text"] = "error"
|
|
57
|
+
end
|
|
58
|
+
else @builder["display.text"] = @builder["display"].text + button.label
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
end
|
|
63
|
+
|
|
@@ -0,0 +1,243 @@
|
|
|
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="window_position">center-always</property>
|
|
8
|
+
<signal name="destroy" handler="destroy_window"/>
|
|
9
|
+
<child>
|
|
10
|
+
<object class="GtkVBox" id="vbox1">
|
|
11
|
+
<property name="visible">True</property>
|
|
12
|
+
<child>
|
|
13
|
+
<object class="GtkEntry" id="display">
|
|
14
|
+
<property name="visible">True</property>
|
|
15
|
+
<property name="can_focus">True</property>
|
|
16
|
+
<property name="editable">False</property>
|
|
17
|
+
<property name="invisible_char">•</property>
|
|
18
|
+
<property name="xalign">1</property>
|
|
19
|
+
</object>
|
|
20
|
+
<packing>
|
|
21
|
+
<property name="position">0</property>
|
|
22
|
+
</packing>
|
|
23
|
+
</child>
|
|
24
|
+
<child>
|
|
25
|
+
<object class="GtkTable" id="table1">
|
|
26
|
+
<property name="visible">True</property>
|
|
27
|
+
<property name="n_rows">4</property>
|
|
28
|
+
<property name="n_columns">4</property>
|
|
29
|
+
<child>
|
|
30
|
+
<object class="GtkButton" id="Calculator.keys[0]">
|
|
31
|
+
<property name="label" translatable="yes">button</property>
|
|
32
|
+
<property name="visible">True</property>
|
|
33
|
+
<property name="can_focus">True</property>
|
|
34
|
+
<property name="receives_default">True</property>
|
|
35
|
+
</object>
|
|
36
|
+
</child>
|
|
37
|
+
<child>
|
|
38
|
+
<object class="GtkButton" id="Calculator.keys[1]">
|
|
39
|
+
<property name="label" translatable="yes">button</property>
|
|
40
|
+
<property name="visible">True</property>
|
|
41
|
+
<property name="can_focus">True</property>
|
|
42
|
+
<property name="receives_default">True</property>
|
|
43
|
+
</object>
|
|
44
|
+
<packing>
|
|
45
|
+
<property name="left_attach">1</property>
|
|
46
|
+
<property name="right_attach">2</property>
|
|
47
|
+
</packing>
|
|
48
|
+
</child>
|
|
49
|
+
<child>
|
|
50
|
+
<object class="GtkButton" id="Calculator.keys[2]">
|
|
51
|
+
<property name="label" translatable="yes">button</property>
|
|
52
|
+
<property name="visible">True</property>
|
|
53
|
+
<property name="can_focus">True</property>
|
|
54
|
+
<property name="receives_default">True</property>
|
|
55
|
+
</object>
|
|
56
|
+
<packing>
|
|
57
|
+
<property name="left_attach">2</property>
|
|
58
|
+
<property name="right_attach">3</property>
|
|
59
|
+
</packing>
|
|
60
|
+
</child>
|
|
61
|
+
<child>
|
|
62
|
+
<object class="GtkButton" id="Calculator.keys[3]">
|
|
63
|
+
<property name="label" translatable="yes">button</property>
|
|
64
|
+
<property name="visible">True</property>
|
|
65
|
+
<property name="can_focus">True</property>
|
|
66
|
+
<property name="receives_default">True</property>
|
|
67
|
+
</object>
|
|
68
|
+
<packing>
|
|
69
|
+
<property name="left_attach">3</property>
|
|
70
|
+
<property name="right_attach">4</property>
|
|
71
|
+
</packing>
|
|
72
|
+
</child>
|
|
73
|
+
<child>
|
|
74
|
+
<object class="GtkButton" id="Calculator.keys[4]">
|
|
75
|
+
<property name="label" translatable="yes">button</property>
|
|
76
|
+
<property name="visible">True</property>
|
|
77
|
+
<property name="can_focus">True</property>
|
|
78
|
+
<property name="receives_default">True</property>
|
|
79
|
+
</object>
|
|
80
|
+
<packing>
|
|
81
|
+
<property name="top_attach">1</property>
|
|
82
|
+
<property name="bottom_attach">2</property>
|
|
83
|
+
</packing>
|
|
84
|
+
</child>
|
|
85
|
+
<child>
|
|
86
|
+
<object class="GtkButton" id="Calculator.keys[5]">
|
|
87
|
+
<property name="label" translatable="yes">button</property>
|
|
88
|
+
<property name="visible">True</property>
|
|
89
|
+
<property name="can_focus">True</property>
|
|
90
|
+
<property name="receives_default">True</property>
|
|
91
|
+
</object>
|
|
92
|
+
<packing>
|
|
93
|
+
<property name="left_attach">1</property>
|
|
94
|
+
<property name="right_attach">2</property>
|
|
95
|
+
<property name="top_attach">1</property>
|
|
96
|
+
<property name="bottom_attach">2</property>
|
|
97
|
+
</packing>
|
|
98
|
+
</child>
|
|
99
|
+
<child>
|
|
100
|
+
<object class="GtkButton" id="keys[6]">
|
|
101
|
+
<property name="label" translatable="yes">button</property>
|
|
102
|
+
<property name="visible">True</property>
|
|
103
|
+
<property name="can_focus">True</property>
|
|
104
|
+
<property name="receives_default">True</property>
|
|
105
|
+
</object>
|
|
106
|
+
<packing>
|
|
107
|
+
<property name="left_attach">2</property>
|
|
108
|
+
<property name="right_attach">3</property>
|
|
109
|
+
<property name="top_attach">1</property>
|
|
110
|
+
<property name="bottom_attach">2</property>
|
|
111
|
+
</packing>
|
|
112
|
+
</child>
|
|
113
|
+
<child>
|
|
114
|
+
<object class="GtkButton" id="Calculator.keys[7]">
|
|
115
|
+
<property name="label" translatable="yes">button</property>
|
|
116
|
+
<property name="visible">True</property>
|
|
117
|
+
<property name="can_focus">True</property>
|
|
118
|
+
<property name="receives_default">True</property>
|
|
119
|
+
</object>
|
|
120
|
+
<packing>
|
|
121
|
+
<property name="left_attach">3</property>
|
|
122
|
+
<property name="right_attach">4</property>
|
|
123
|
+
<property name="top_attach">1</property>
|
|
124
|
+
<property name="bottom_attach">2</property>
|
|
125
|
+
</packing>
|
|
126
|
+
</child>
|
|
127
|
+
<child>
|
|
128
|
+
<object class="GtkButton" id="Calculator.keys[8]">
|
|
129
|
+
<property name="label" translatable="yes">button</property>
|
|
130
|
+
<property name="visible">True</property>
|
|
131
|
+
<property name="can_focus">True</property>
|
|
132
|
+
<property name="receives_default">True</property>
|
|
133
|
+
</object>
|
|
134
|
+
<packing>
|
|
135
|
+
<property name="top_attach">2</property>
|
|
136
|
+
<property name="bottom_attach">3</property>
|
|
137
|
+
</packing>
|
|
138
|
+
</child>
|
|
139
|
+
<child>
|
|
140
|
+
<object class="GtkButton" id="Calculator.keys[9]">
|
|
141
|
+
<property name="label" translatable="yes">button</property>
|
|
142
|
+
<property name="visible">True</property>
|
|
143
|
+
<property name="can_focus">True</property>
|
|
144
|
+
<property name="receives_default">True</property>
|
|
145
|
+
</object>
|
|
146
|
+
<packing>
|
|
147
|
+
<property name="left_attach">1</property>
|
|
148
|
+
<property name="right_attach">2</property>
|
|
149
|
+
<property name="top_attach">2</property>
|
|
150
|
+
<property name="bottom_attach">3</property>
|
|
151
|
+
</packing>
|
|
152
|
+
</child>
|
|
153
|
+
<child>
|
|
154
|
+
<object class="GtkButton" id="Calculator.keys[10]">
|
|
155
|
+
<property name="label" translatable="yes">button</property>
|
|
156
|
+
<property name="visible">True</property>
|
|
157
|
+
<property name="can_focus">True</property>
|
|
158
|
+
<property name="receives_default">True</property>
|
|
159
|
+
</object>
|
|
160
|
+
<packing>
|
|
161
|
+
<property name="left_attach">2</property>
|
|
162
|
+
<property name="right_attach">3</property>
|
|
163
|
+
<property name="top_attach">2</property>
|
|
164
|
+
<property name="bottom_attach">3</property>
|
|
165
|
+
</packing>
|
|
166
|
+
</child>
|
|
167
|
+
<child>
|
|
168
|
+
<object class="GtkButton" id="Calculator.keys[11]">
|
|
169
|
+
<property name="label" translatable="yes">button</property>
|
|
170
|
+
<property name="visible">True</property>
|
|
171
|
+
<property name="can_focus">True</property>
|
|
172
|
+
<property name="receives_default">True</property>
|
|
173
|
+
</object>
|
|
174
|
+
<packing>
|
|
175
|
+
<property name="left_attach">3</property>
|
|
176
|
+
<property name="right_attach">4</property>
|
|
177
|
+
<property name="top_attach">2</property>
|
|
178
|
+
<property name="bottom_attach">3</property>
|
|
179
|
+
</packing>
|
|
180
|
+
</child>
|
|
181
|
+
<child>
|
|
182
|
+
<object class="GtkButton" id="Calculator.keys[12]">
|
|
183
|
+
<property name="label" translatable="yes">button</property>
|
|
184
|
+
<property name="visible">True</property>
|
|
185
|
+
<property name="can_focus">True</property>
|
|
186
|
+
<property name="receives_default">True</property>
|
|
187
|
+
</object>
|
|
188
|
+
<packing>
|
|
189
|
+
<property name="top_attach">3</property>
|
|
190
|
+
<property name="bottom_attach">4</property>
|
|
191
|
+
</packing>
|
|
192
|
+
</child>
|
|
193
|
+
<child>
|
|
194
|
+
<object class="GtkButton" id="Calculator.keys[13]">
|
|
195
|
+
<property name="label" translatable="yes">button</property>
|
|
196
|
+
<property name="visible">True</property>
|
|
197
|
+
<property name="can_focus">True</property>
|
|
198
|
+
<property name="receives_default">True</property>
|
|
199
|
+
</object>
|
|
200
|
+
<packing>
|
|
201
|
+
<property name="left_attach">1</property>
|
|
202
|
+
<property name="right_attach">2</property>
|
|
203
|
+
<property name="top_attach">3</property>
|
|
204
|
+
<property name="bottom_attach">4</property>
|
|
205
|
+
</packing>
|
|
206
|
+
</child>
|
|
207
|
+
<child>
|
|
208
|
+
<object class="GtkButton" id="Calculator.keys[14]">
|
|
209
|
+
<property name="label" translatable="yes">button</property>
|
|
210
|
+
<property name="visible">True</property>
|
|
211
|
+
<property name="can_focus">True</property>
|
|
212
|
+
<property name="receives_default">True</property>
|
|
213
|
+
</object>
|
|
214
|
+
<packing>
|
|
215
|
+
<property name="left_attach">2</property>
|
|
216
|
+
<property name="right_attach">3</property>
|
|
217
|
+
<property name="top_attach">3</property>
|
|
218
|
+
<property name="bottom_attach">4</property>
|
|
219
|
+
</packing>
|
|
220
|
+
</child>
|
|
221
|
+
<child>
|
|
222
|
+
<object class="GtkButton" id="Calculator.keys[15]">
|
|
223
|
+
<property name="label" translatable="yes">button</property>
|
|
224
|
+
<property name="visible">True</property>
|
|
225
|
+
<property name="can_focus">True</property>
|
|
226
|
+
<property name="receives_default">True</property>
|
|
227
|
+
</object>
|
|
228
|
+
<packing>
|
|
229
|
+
<property name="left_attach">3</property>
|
|
230
|
+
<property name="right_attach">4</property>
|
|
231
|
+
<property name="top_attach">3</property>
|
|
232
|
+
<property name="bottom_attach">4</property>
|
|
233
|
+
</packing>
|
|
234
|
+
</child>
|
|
235
|
+
</object>
|
|
236
|
+
<packing>
|
|
237
|
+
<property name="position">1</property>
|
|
238
|
+
</packing>
|
|
239
|
+
</child>
|
|
240
|
+
</object>
|
|
241
|
+
</child>
|
|
242
|
+
</object>
|
|
243
|
+
</interface>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
require 'vrlib.rb'
|
|
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
|
+
Calculator.new.show
|
|
13
|
+
|
|
@@ -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/child_window/main.rb
|
|
5
|
+
font_name: Monospace 10
|
|
6
|
+
glade_path: glade-gtk2
|
|
7
|
+
height: 637
|
|
8
|
+
open_files:
|
|
9
|
+
- /home/eric/vrp/vrx/visualruby_examples/child_window/bin/ChildWindowDemo.rb
|
|
10
|
+
- /home/eric/vrp/vrx/visualruby_examples/child_window/bin/MyChildClass.rb
|
|
11
|
+
- /home/eric/vrp/vrx/visualruby_examples/child_window/main.rb
|
|
12
|
+
open_folders:
|
|
13
|
+
- /home/eric/vrp/vrx/visualruby_examples/child_window
|
|
14
|
+
- /home/eric/vrp/vrx/visualruby_examples/child_window/bin
|
|
15
|
+
- /home/eric/vrp/vrx/visualruby_examples/child_window/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: 1031
|
|
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,41 @@
|
|
|
1
|
+
|
|
2
|
+
##
|
|
3
|
+
# This is a "main" GUI class for a program. It will spawn
|
|
4
|
+
# child windows that must close when MyClass's window closes
|
|
5
|
+
# It starts a Gtk.main program loop by calling show().
|
|
6
|
+
# When the user clicks the "X" button, the window will be
|
|
7
|
+
# automatically destroyed, and Gtk.main.quit will be called, terminating
|
|
8
|
+
# the Gtk.main loop. This happens because this window's destroy
|
|
9
|
+
# signal has been set in glade to: destroy_window.
|
|
10
|
+
#
|
|
11
|
+
# If you don't understand, don't worry. Here's what you
|
|
12
|
+
# need to know:
|
|
13
|
+
#
|
|
14
|
+
# 1) The show() method takes one argument: a reference to the parent.
|
|
15
|
+
# If no parent is given, it will open as Modal.
|
|
16
|
+
# 2) Call show_window() (window appears)
|
|
17
|
+
# 3) You can terminate the loop by calling destroy_window()
|
|
18
|
+
#
|
|
19
|
+
|
|
20
|
+
class ChildWindowDemo #(change name)
|
|
21
|
+
|
|
22
|
+
include GladeGUI
|
|
23
|
+
|
|
24
|
+
def buttonOpenChild__clicked(*argv)
|
|
25
|
+
win = MyChildClass.new
|
|
26
|
+
win.set_parent(self)
|
|
27
|
+
win.show #self = parent
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def modalButton__clicked(*argv)
|
|
31
|
+
MyChildClass.new.show
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def cancelButton__clicked(*argv)
|
|
35
|
+
destroy_window()
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This shows how to make child windows that close when
|
|
3
|
+
# their parent window closes.
|
|
4
|
+
#
|
|
5
|
+
# Passing a reference to the parent to the new() method solves all the
|
|
6
|
+
# complications of running the child and parent simultaniously.
|
|
7
|
+
#
|
|
8
|
+
# The passing the parent to the new() constructor does three things:
|
|
9
|
+
#
|
|
10
|
+
# 1) It registers the parent window (using win.transient_for=parent )
|
|
11
|
+
# 2) It causes show() to run the child in the main window's
|
|
12
|
+
# Gtk.main loop, instead of starting its own loop.
|
|
13
|
+
# 3) It causes destroy_window() to destroy only the child without
|
|
14
|
+
# calling Gtk.main.quit, so the main program's loop continues after
|
|
15
|
+
# the child is destroyed.
|
|
16
|
+
#
|
|
17
|
+
# So, just pass a reference to the parent to load_glade for all child windows,
|
|
18
|
+
# and everyting will be done automatically:
|
|
19
|
+
#
|
|
20
|
+
class MyChildClass
|
|
21
|
+
|
|
22
|
+
include GladeGUI
|
|
23
|
+
|
|
24
|
+
def initialize(parent = nil)
|
|
25
|
+
super()
|
|
26
|
+
set_parent(parent) if parent
|
|
27
|
+
if parent.nil?
|
|
28
|
+
@hello.label = "MODAL WINDOW\nThis window freezes the parent program until it is closed.\nTherefore you can't open any more windows, or close the\n parent window until you close this window."
|
|
29
|
+
@window1.title = "Modal Window"
|
|
30
|
+
else
|
|
31
|
+
@hello.label = "NON-MODAL WINDOW\n This window doesn't interfere with the operation of the rest of the program.\nTherefore you can open more of these windows if you like.\nIf you close the parent, I will close too."
|
|
32
|
+
@window1.title = "Non-Modal Window"
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# When cancel clicked in MyChildClass.glade
|
|
37
|
+
def buttonCancel__clicked(*argv)
|
|
38
|
+
destroy_window()
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
|