visualruby 3.4.13 → 3.6.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/.vr_settings.yaml +10 -29
- data/examples/active_record/bin/glade/ChoosePerson.glade +19 -19
- data/examples/filetreeview/.vr_settings.yaml +4 -4
- data/examples/filetreeview/bin/ProjectTree.rb +1 -1
- data/examples/listview/.vr_settings.yaml +4 -3
- data/examples/settings_file/.vr_settings.yaml +4 -4
- data/examples/settings_file/settings.yaml +4 -2
- data/examples/treeview/.vr_settings.yaml +6 -6
- data/lib/GladeGUI.rb +330 -325
- data/lib/SavableClass.rb +1 -1
- data/lib/vrlib.rb +33 -3
- data/src/main/OpenProject.rb +4 -2
- data/src/version.rb +1 -1
- data/vr +28 -8
- metadata +16 -19
- data/.yardoc/my_yard.yaml +0 -19
- data/lib/ActLikeAHash.rb +0 -12
- data/lib/SavableHash.rb +0 -25
- /data/{doc → docs}/img/logo.png +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3c57043153d4d8593b9731e6f4723caf9f8204d95c11caff0ddfa9dfe3264cdf
|
|
4
|
+
data.tar.gz: 127d48e3eb22f788ad8dc1d12b9b0b0114362ef01fcb180069e5f188c473f084
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d6669fe6375b6be283bc39a042d231e811c7d9121edebab47ed26ca8ef20911197bae042d56808229142dceeb269126e6417a37c64558787c62ee8a7da704041
|
|
7
|
+
data.tar.gz: 531aaea75548e52c4b51c27cef2f548f58ee296f950e650c76bbcce88fd73b76c41fa89ebd5e58de50f191230086e141dc856284b4a175f315b84890a6be244b
|
data/.vr_settings.yaml
CHANGED
|
@@ -1,31 +1,12 @@
|
|
|
1
1
|
--- !ruby/object:VR_ENV
|
|
2
2
|
vr_yaml_file: "/home/eric/vrp/vr3/.vr_settings.yaml"
|
|
3
|
-
width:
|
|
4
|
-
height:
|
|
5
|
-
panel_pos:
|
|
6
|
-
notebook_panel_position:
|
|
7
|
-
run_command_line: ruby
|
|
8
|
-
open_files:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
- "/home/eric/vrp/vr3/lib/oinspect/MethodsListView.rb"
|
|
14
|
-
- "/home/eric/vrp/vr3/lib/treeview/ViewCommon.rb"
|
|
15
|
-
- "/home/eric/vrp/vr3/lib/treeview/FileTreeView.rb"
|
|
16
|
-
- "/home/eric/vrp/vr3/src/editor/VR_Document.rb"
|
|
17
|
-
- "/home/eric/vrp/vr3/src/main/VR_Main.rb"
|
|
18
|
-
open_folders:
|
|
19
|
-
- "/home/eric/vrp/vr3"
|
|
20
|
-
- "/home/eric/vrp/vr3/lib"
|
|
21
|
-
- "/home/eric/vrp/vr3/lib/treeview"
|
|
22
|
-
- "/home/eric/vrp/vr3/skeleton"
|
|
23
|
-
- "/home/eric/vrp/vr3/skeleton/document"
|
|
24
|
-
- "/home/eric/vrp/vr3/src"
|
|
25
|
-
- "/home/eric/vrp/vr3/src/editor"
|
|
26
|
-
- "/home/eric/vrp/vr3/src/main"
|
|
27
|
-
current_file: "/home/eric/vrp/vr3/vr"
|
|
28
|
-
current_line: 29
|
|
29
|
-
rdoc_command_line: yardoc lib - site/*.*
|
|
30
|
-
builder: !ruby/object:Gtk::Builder {}
|
|
31
|
-
top_level_window: false
|
|
3
|
+
width: 800
|
|
4
|
+
height: 600
|
|
5
|
+
panel_pos: 360
|
|
6
|
+
notebook_panel_position: 400
|
|
7
|
+
run_command_line: ruby main.rb
|
|
8
|
+
open_files: []
|
|
9
|
+
open_folders: []
|
|
10
|
+
current_file: ''
|
|
11
|
+
current_line: 1
|
|
12
|
+
rdoc_command_line: rdoc -x README
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!-- Generated with glade 3.
|
|
2
|
+
<!-- Generated with glade 3.40.0 -->
|
|
3
3
|
<interface>
|
|
4
4
|
<requires lib="gtk+" version="3.0"/>
|
|
5
5
|
<object class="GtkWindow" id="window1">
|
|
6
|
-
<property name="
|
|
6
|
+
<property name="can-focus">False</property>
|
|
7
7
|
<property name="title" translatable="yes">Active Record Demo</property>
|
|
8
|
-
<property name="
|
|
9
|
-
<property name="
|
|
10
|
-
<property name="
|
|
8
|
+
<property name="window-position">center</property>
|
|
9
|
+
<property name="default-width">450</property>
|
|
10
|
+
<property name="default-height">300</property>
|
|
11
11
|
<child>
|
|
12
12
|
<object class="GtkBox" id="box1">
|
|
13
13
|
<property name="visible">True</property>
|
|
14
|
-
<property name="
|
|
15
|
-
<property name="
|
|
16
|
-
<property name="
|
|
17
|
-
<property name="
|
|
18
|
-
<property name="
|
|
14
|
+
<property name="can-focus">False</property>
|
|
15
|
+
<property name="margin-left">20</property>
|
|
16
|
+
<property name="margin-right">20</property>
|
|
17
|
+
<property name="margin-top">20</property>
|
|
18
|
+
<property name="margin-bottom">20</property>
|
|
19
19
|
<property name="orientation">vertical</property>
|
|
20
20
|
<child>
|
|
21
21
|
<object class="GtkLabel" id="label1">
|
|
22
22
|
<property name="visible">True</property>
|
|
23
|
-
<property name="
|
|
23
|
+
<property name="can-focus">False</property>
|
|
24
24
|
<property name="label" translatable="yes"><big><big>Choose Person:</big></big></property>
|
|
25
|
-
<property name="
|
|
25
|
+
<property name="use-markup">True</property>
|
|
26
26
|
</object>
|
|
27
27
|
<packing>
|
|
28
28
|
<property name="expand">False</property>
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<child>
|
|
34
34
|
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
|
35
35
|
<property name="visible">True</property>
|
|
36
|
-
<property name="
|
|
36
|
+
<property name="can-focus">True</property>
|
|
37
37
|
<child>
|
|
38
38
|
<placeholder/>
|
|
39
39
|
</child>
|
|
@@ -47,15 +47,15 @@
|
|
|
47
47
|
<child>
|
|
48
48
|
<object class="GtkButtonBox" id="buttonbox1">
|
|
49
49
|
<property name="visible">True</property>
|
|
50
|
-
<property name="
|
|
50
|
+
<property name="can-focus">False</property>
|
|
51
51
|
<property name="spacing">10</property>
|
|
52
|
-
<property name="
|
|
52
|
+
<property name="layout-style">end</property>
|
|
53
53
|
<child>
|
|
54
54
|
<object class="GtkButton" id="buttonCancel">
|
|
55
55
|
<property name="label" translatable="yes">Cancel</property>
|
|
56
56
|
<property name="visible">True</property>
|
|
57
|
-
<property name="
|
|
58
|
-
<property name="
|
|
57
|
+
<property name="can-focus">True</property>
|
|
58
|
+
<property name="receives-default">True</property>
|
|
59
59
|
</object>
|
|
60
60
|
<packing>
|
|
61
61
|
<property name="expand">False</property>
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
<object class="GtkButton" id="buttonShow">
|
|
68
68
|
<property name="label" translatable="yes">Show</property>
|
|
69
69
|
<property name="visible">True</property>
|
|
70
|
-
<property name="
|
|
71
|
-
<property name="
|
|
70
|
+
<property name="can-focus">True</property>
|
|
71
|
+
<property name="receives-default">True</property>
|
|
72
72
|
</object>
|
|
73
73
|
<packing>
|
|
74
74
|
<property name="expand">False</property>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:VR_ENV
|
|
2
2
|
vr_yaml_file: "/home/eric/vrp/vr3/examples/filetreeview/.vr_settings.yaml"
|
|
3
|
-
width:
|
|
4
|
-
height:
|
|
3
|
+
width: 1301
|
|
4
|
+
height: 744
|
|
5
5
|
panel_pos: 490
|
|
6
6
|
notebook_panel_position: 400
|
|
7
7
|
run_command_line: ruby main.rb
|
|
@@ -14,8 +14,8 @@ open_folders:
|
|
|
14
14
|
- "/home/eric/vrp/vr3/examples/filetreeview/bin"
|
|
15
15
|
- "/home/eric/vrp/vr3/examples/filetreeview/bin/glade"
|
|
16
16
|
- "/home/eric/vrp/vr3/examples/filetreeview/img"
|
|
17
|
-
current_file: "/home/eric/vrp/vr3/examples/filetreeview/
|
|
18
|
-
current_line:
|
|
17
|
+
current_file: "/home/eric/vrp/vr3/examples/filetreeview/bin/ProjectTree.rb"
|
|
18
|
+
current_line: 15
|
|
19
19
|
rdoc_command_line: rdoc -x README
|
|
20
20
|
settings_file_version: 1
|
|
21
21
|
filename: ".vr_settings.yaml"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:VR_ENV
|
|
2
2
|
vr_yaml_file: "/home/eric/vrp/vr3/examples/listview/.vr_settings.yaml"
|
|
3
|
-
width:
|
|
4
|
-
height:
|
|
3
|
+
width: 1301
|
|
4
|
+
height: 744
|
|
5
5
|
panel_pos: 322
|
|
6
6
|
notebook_panel_position: 437
|
|
7
7
|
run_command_line: ruby main.rb
|
|
@@ -12,7 +12,8 @@ open_files:
|
|
|
12
12
|
open_folders:
|
|
13
13
|
- "/home/eric/vrp/vr3/examples/listview"
|
|
14
14
|
- "/home/eric/vrp/vr3/examples/listview/bin"
|
|
15
|
+
- "/home/eric/vrp/vr3/examples/listview/bin/glade"
|
|
15
16
|
current_file: "/home/eric/vrp/vr3/examples/listview/bin/SongListViewGUI.rb"
|
|
16
|
-
current_line:
|
|
17
|
+
current_line: 19
|
|
17
18
|
rdoc_command_line: rdoc -x README
|
|
18
19
|
filename: ".vr_settings.yaml"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:VR_ENV
|
|
2
2
|
vr_yaml_file: "/home/eric/vrp/vr3/examples/settings_file/.vr_settings.yaml"
|
|
3
|
-
width:
|
|
4
|
-
height:
|
|
3
|
+
width: 1301
|
|
4
|
+
height: 744
|
|
5
5
|
panel_pos: 360
|
|
6
6
|
notebook_panel_position: 400
|
|
7
7
|
run_command_line: ruby main.rb
|
|
@@ -13,6 +13,6 @@ open_folders:
|
|
|
13
13
|
- "/home/eric/vrp/vr3/examples/settings_file"
|
|
14
14
|
- "/home/eric/vrp/vr3/examples/settings_file/bin"
|
|
15
15
|
- "/home/eric/vrp/vr3/examples/settings_file/bin/glade"
|
|
16
|
-
current_file: "/home/eric/vrp/vr3/examples/settings_file/bin/
|
|
17
|
-
current_line:
|
|
16
|
+
current_file: "/home/eric/vrp/vr3/examples/settings_file/bin/MainApp.rb"
|
|
17
|
+
current_line: 26
|
|
18
18
|
rdoc_command_line: rdoc -x README
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:SavableSettings
|
|
2
2
|
height: 414
|
|
3
|
-
width:
|
|
4
|
-
title: Savable Settings Demo
|
|
3
|
+
width: 533
|
|
4
|
+
title: Savable Settings Demo x
|
|
5
5
|
text: |-
|
|
6
6
|
Try running this program multiple times.
|
|
7
7
|
|
|
@@ -11,3 +11,5 @@ text: |-
|
|
|
11
11
|
|
|
12
12
|
You may need to click the 'Refresh' to see the settings.yaml file.
|
|
13
13
|
vr_yaml_file: "/home/eric/vrp/vr3/examples/settings_file/settings.yaml"
|
|
14
|
+
builder: !ruby/object:Gtk::Builder {}
|
|
15
|
+
top_level_window: false
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
--- !ruby/object:VR_ENV
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
vr_yaml_file: "/home/eric/vrp/vr3/examples/treeview/.vr_settings.yaml"
|
|
3
|
+
width: 1301
|
|
4
|
+
height: 744
|
|
4
5
|
panel_pos: 491
|
|
6
|
+
notebook_panel_position: 400
|
|
5
7
|
run_command_line: ruby main.rb
|
|
6
8
|
open_files:
|
|
7
9
|
- "/home/eric/vrp/vr3/examples/treeview/main.rb"
|
|
@@ -9,9 +11,7 @@ open_files:
|
|
|
9
11
|
open_folders:
|
|
10
12
|
- "/home/eric/vrp/vr3/examples/treeview"
|
|
11
13
|
- "/home/eric/vrp/vr3/examples/treeview/bin"
|
|
12
|
-
current_file: "/home/eric/vrp/vr3/examples/treeview/
|
|
14
|
+
current_file: "/home/eric/vrp/vr3/examples/treeview/bin/MyClass.rb"
|
|
15
|
+
current_line: 1
|
|
13
16
|
rdoc_command_line: rdoc -x README
|
|
14
|
-
vr_yaml_file: ".vr_settings.yaml"
|
|
15
|
-
notebook_panel_position: 400
|
|
16
|
-
current_line: 14
|
|
17
17
|
settings_file_version: 1
|
data/lib/GladeGUI.rb
CHANGED
|
@@ -1,143 +1,144 @@
|
|
|
1
|
-
|
|
2
|
-
# GladeGUI connects your class to a glade form.
|
|
3
|
-
# It will load a .glade
|
|
4
|
-
# file into memory, enabling your ruby programs to have a GUI interface.
|
|
5
|
-
#
|
|
6
|
-
# GladeGUI works by adding an instance variable named "builder" to your class. The "builder"
|
|
7
|
-
# variable is an instance of {Gtk::Builder}[http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3ABuilder]
|
|
8
|
-
# It holds references to all your windows and widgets.
|
|
9
|
-
#
|
|
10
|
-
# ==Include the GladeGUI interface
|
|
11
|
-
#
|
|
1
|
+
|
|
2
|
+
# GladeGUI connects your class to a glade form.
|
|
3
|
+
# It will load a .glade
|
|
4
|
+
# file into memory, enabling your ruby programs to have a GUI interface.
|
|
5
|
+
#
|
|
6
|
+
# GladeGUI works by adding an instance variable named "builder" to your class. The "builder"
|
|
7
|
+
# variable is an instance of {Gtk::Builder}[http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3ABuilder]
|
|
8
|
+
# It holds references to all your windows and widgets.
|
|
9
|
+
#
|
|
10
|
+
# ==Include the GladeGUI interface
|
|
11
|
+
#
|
|
12
12
|
# To use the GladeGUI interface, include this line in your code:
|
|
13
13
|
#
|
|
14
14
|
# class MyClass
|
|
15
15
|
# include GladeGUI
|
|
16
|
-
# end
|
|
17
|
-
#
|
|
18
|
-
# GladeGUI will load a corresponding
|
|
19
|
-
# glade file for this class. It knows which glade file to load by using a naming
|
|
20
|
-
# convention:
|
|
21
|
-
#
|
|
22
|
-
# /folder/MyClass.rb
|
|
23
|
-
#
|
|
24
|
-
# Will load this glade file:
|
|
25
|
-
#
|
|
26
|
-
# /folder/glade/MyClass.glade
|
|
27
|
-
#
|
|
28
|
-
# The class, the class file name and the glade file name must match.
|
|
29
|
-
# You should always name your class, script, and glade file
|
|
30
|
-
# the same name (case sensitive).
|
|
31
|
-
#
|
|
32
|
-
# == <tt>builder</tt> variable holds all your widgets
|
|
33
|
-
#
|
|
34
|
-
# So when you "load" your class's glade file where is it loaded?
|
|
35
|
-
#
|
|
36
|
-
# GladeGUI adds an instance variable, builder to your class.
|
|
37
|
-
# It loads all the windows and widgets from your glade file into @builder.
|
|
38
|
-
# So, you use <tt>@builder</tt> to manipulate everything in you class's GUI.
|
|
39
|
-
# <tt>@builder</tt> is set when you call the show_glade() method, as this code shows:
|
|
40
|
-
#
|
|
41
|
-
# class MyClass
|
|
42
|
-
#
|
|
43
|
-
# include GladeGUI
|
|
44
|
-
#
|
|
45
|
-
# def initialize()
|
|
46
|
-
# puts @builder.to_s # => nil
|
|
47
|
-
# end
|
|
48
|
-
#
|
|
49
|
-
# def before_show()
|
|
50
|
-
# puts @builder.to_s # => Gtk::Builder
|
|
51
|
-
# end
|
|
52
|
-
#
|
|
53
|
-
# end
|
|
54
|
-
#
|
|
55
|
-
# After show_glade() is called, you can access any of your form's windows or widgets
|
|
56
|
-
# using the @builder variable:
|
|
57
|
-
#
|
|
58
|
-
# @builder["window1"].title = "This is the title that appears at the top."
|
|
59
|
-
#
|
|
60
|
-
#
|
|
61
|
-
# Here's another example: Suppose you have a glade form with a Gtk::Entry box on it named "email."
|
|
62
|
-
# You could set the text that appears in the Gtk::Entry by setting the Gtk::Entry#text property:
|
|
63
|
-
#
|
|
64
|
-
# @builder["email"].text = "harvey@harveyserver.com"
|
|
65
|
-
#
|
|
66
|
-
# Now the email adddess is set with a new value:
|
|
67
|
-
#
|
|
68
|
-
# http://visualruby.net/img/gladegui_simple.jpg
|
|
69
|
-
#
|
|
70
|
-
# == Auto fill your glade form
|
|
71
|
-
# You can streamline the process of setting-up your forms by
|
|
72
|
-
# auto-filling the widgets from instance variables with the same name.
|
|
73
|
-
#
|
|
74
|
-
# When assigning names to widgets in glade, give them names that
|
|
75
|
-
# correspond to your instance variables. For example, if you want
|
|
76
|
-
# to edit an email address on the glade form, create an instance
|
|
77
|
-
# variable named @email in your class. Then, in glade, you
|
|
78
|
-
# add a Gtk::Entry widget to your form and set its name to
|
|
79
|
-
# “email”. The advantage of this is that GladeGUI will populate
|
|
80
|
-
# the “email” widget in glade using the @email variable. so
|
|
81
|
-
# you don’t need to include the above line of code. (see
|
|
82
|
-
# set_glade_variables() method.)
|
|
83
|
-
module GladeGUI
|
|
84
|
-
|
|
85
|
-
# @!attribute [rw] builder
|
|
16
|
+
# end
|
|
17
|
+
#
|
|
18
|
+
# GladeGUI will load a corresponding
|
|
19
|
+
# glade file for this class. It knows which glade file to load by using a naming
|
|
20
|
+
# convention:
|
|
21
|
+
#
|
|
22
|
+
# /folder/MyClass.rb
|
|
23
|
+
#
|
|
24
|
+
# Will load this glade file:
|
|
25
|
+
#
|
|
26
|
+
# /folder/glade/MyClass.glade
|
|
27
|
+
#
|
|
28
|
+
# The class, the class file name and the glade file name must match.
|
|
29
|
+
# You should always name your class, script, and glade file
|
|
30
|
+
# the same name (case sensitive).
|
|
31
|
+
#
|
|
32
|
+
# == <tt>builder</tt> variable holds all your widgets
|
|
33
|
+
#
|
|
34
|
+
# So when you "load" your class's glade file where is it loaded?
|
|
35
|
+
#
|
|
36
|
+
# GladeGUI adds an instance variable, builder to your class.
|
|
37
|
+
# It loads all the windows and widgets from your glade file into @builder.
|
|
38
|
+
# So, you use <tt>@builder</tt> to manipulate everything in you class's GUI.
|
|
39
|
+
# <tt>@builder</tt> is set when you call the show_glade() method, as this code shows:
|
|
40
|
+
#
|
|
41
|
+
# class MyClass
|
|
42
|
+
#
|
|
43
|
+
# include GladeGUI
|
|
44
|
+
#
|
|
45
|
+
# def initialize()
|
|
46
|
+
# puts @builder.to_s # => nil
|
|
47
|
+
# end
|
|
48
|
+
#
|
|
49
|
+
# def before_show()
|
|
50
|
+
# puts @builder.to_s # => Gtk::Builder
|
|
51
|
+
# end
|
|
52
|
+
#
|
|
53
|
+
# end
|
|
54
|
+
#
|
|
55
|
+
# After show_glade() is called, you can access any of your form's windows or widgets
|
|
56
|
+
# using the @builder variable:
|
|
57
|
+
#
|
|
58
|
+
# @builder["window1"].title = "This is the title that appears at the top."
|
|
59
|
+
#
|
|
60
|
+
#
|
|
61
|
+
# Here's another example: Suppose you have a glade form with a Gtk::Entry box on it named "email."
|
|
62
|
+
# You could set the text that appears in the Gtk::Entry by setting the Gtk::Entry#text property:
|
|
63
|
+
#
|
|
64
|
+
# @builder["email"].text = "harvey@harveyserver.com"
|
|
65
|
+
#
|
|
66
|
+
# Now the email adddess is set with a new value:
|
|
67
|
+
#
|
|
68
|
+
# http://visualruby.net/img/gladegui_simple.jpg
|
|
69
|
+
#
|
|
70
|
+
# == Auto fill your glade form
|
|
71
|
+
# You can streamline the process of setting-up your forms by
|
|
72
|
+
# auto-filling the widgets from instance variables with the same name.
|
|
73
|
+
#
|
|
74
|
+
# When assigning names to widgets in glade, give them names that
|
|
75
|
+
# correspond to your instance variables. For example, if you want
|
|
76
|
+
# to edit an email address on the glade form, create an instance
|
|
77
|
+
# variable named @email in your class. Then, in glade, you
|
|
78
|
+
# add a Gtk::Entry widget to your form and set its name to
|
|
79
|
+
# “email”. The advantage of this is that GladeGUI will populate
|
|
80
|
+
# the “email” widget in glade using the @email variable. so
|
|
81
|
+
# you don’t need to include the above line of code. (see
|
|
82
|
+
# set_glade_variables() method.)
|
|
83
|
+
module GladeGUI
|
|
84
|
+
|
|
85
|
+
# @!attribute [rw] builder
|
|
86
86
|
# @return [Gtk::Builder] The builder that holds references to everything in the glade form.
|
|
87
87
|
attr_accessor :builder
|
|
88
|
-
|
|
89
|
-
##
|
|
90
|
-
#
|
|
91
|
-
# drag_to() will make it so you can drag-n-drop the source_widget onto the target widget.
|
|
92
|
-
# You may pass a reference to a widget object, or a String that gives the name of the
|
|
93
|
-
# widget on your glade form. So, it functions the same as this statement:
|
|
94
|
-
#
|
|
95
|
-
# widget_source.drag_to(widget_target)
|
|
96
|
-
#
|
|
97
|
-
# It also functions the same as this statement:
|
|
98
|
-
#
|
|
99
|
-
# @builder["widget_source"].drag_to(@builder["widget_target"])
|
|
100
|
-
def set_drag_drop(hash)
|
|
101
|
-
hash.each do |key,val|
|
|
102
|
-
src = key.is_a?(Gtk::Widget) ? key : @builder[key]
|
|
103
|
-
target = @builder[val]
|
|
104
|
-
src.extend(VR::Draggable) unless src.is_a?(VR::Draggable)
|
|
105
|
-
src.add_target_widget(target)
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
##
|
|
88
|
+
|
|
89
|
+
##
|
|
90
|
+
#
|
|
91
|
+
# drag_to() will make it so you can drag-n-drop the source_widget onto the target widget.
|
|
92
|
+
# You may pass a reference to a widget object, or a String that gives the name of the
|
|
93
|
+
# widget on your glade form. So, it functions the same as this statement:
|
|
94
|
+
#
|
|
95
|
+
# widget_source.drag_to(widget_target)
|
|
96
|
+
#
|
|
97
|
+
# It also functions the same as this statement:
|
|
98
|
+
#
|
|
99
|
+
# @builder["widget_source"].drag_to(@builder["widget_target"])
|
|
100
|
+
def set_drag_drop(hash)
|
|
101
|
+
hash.each do |key,val|
|
|
102
|
+
src = key.is_a?(Gtk::Widget) ? key : @builder[key]
|
|
103
|
+
target = @builder[val]
|
|
104
|
+
src.extend(VR::Draggable) unless src.is_a?(VR::Draggable)
|
|
105
|
+
src.add_target_widget(target)
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
##
|
|
112
112
|
# This will Load the glade form according to the naming convention:
|
|
113
|
-
# MyClass.rb => MyClass.glade.
|
|
114
|
-
# It will create a Gtk::Builder object from your glade file.
|
|
115
|
-
# The Gtk::Builder object is stored in the instance variable, @builder.
|
|
116
|
-
# You can get a reference to any of the widgets on the glade form by
|
|
117
|
-
# using the @builder object:
|
|
113
|
+
# MyClass.rb => MyClass.glade.
|
|
114
|
+
# It will create a Gtk::Builder object from your glade file.
|
|
115
|
+
# The Gtk::Builder object is stored in the instance variable, @builder.
|
|
116
|
+
# You can get a reference to any of the widgets on the glade form by
|
|
117
|
+
# using the @builder object:
|
|
118
118
|
#
|
|
119
|
-
# @example
|
|
120
|
-
# widget = @builder["name"]
|
|
121
|
-
#
|
|
122
|
-
# Normally, you should give your widgets names of instance variables: i.e. @email
|
|
119
|
+
# @example
|
|
120
|
+
# widget = @builder["name"]
|
|
121
|
+
#
|
|
122
|
+
# Normally, you should give your widgets names of instance variables: i.e. @email
|
|
123
123
|
# so they can be autoloaded when the glade form is shown using the #show_glade method. For example,
|
|
124
124
|
# the value of the @email vaiable would be loaded into a Gtk:Entry named "email"
|
|
125
125
|
# in your glade form. It saves you from having to do this:
|
|
126
126
|
#
|
|
127
127
|
# @example
|
|
128
|
-
# @builder[:email].text = @email
|
|
129
|
-
#
|
|
130
|
-
def load_glade()
|
|
131
|
-
caller__FILE__ = my_class_file_path()
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
@builder
|
|
135
|
-
@builder
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
128
|
+
# @builder[:email].text = @email
|
|
129
|
+
#
|
|
130
|
+
def load_glade()
|
|
131
|
+
caller__FILE__ = my_class_file_path()
|
|
132
|
+
puts "PATH PROBLEM: " + caller__FILE__
|
|
133
|
+
file_name = File.join(File.split(caller__FILE__)[0] , "glade", class_name(self) + ".glade")
|
|
134
|
+
@builder = Gtk::Builder.new
|
|
135
|
+
@builder << file_name
|
|
136
|
+
@builder.connect_signals{ |handle| method(handle) }
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
private def class_name(obj)
|
|
140
|
+
/.*\b(\w+)$/.match(obj.class.name)[1]
|
|
141
|
+
end
|
|
141
142
|
|
|
142
143
|
# Connects gtk's signals to your methods according to the naming convention widget__signal. For example,
|
|
143
144
|
# when you place a button called "button1" in your glade form, and declare a method called
|
|
@@ -150,27 +151,27 @@ module GladeGUI
|
|
|
150
151
|
# self__row_activated(*args)
|
|
151
152
|
# instance_variable__key_press_event(*args)
|
|
152
153
|
#
|
|
153
|
-
# Remember that it will enforce the naming convention: name__signal (two underscores).
|
|
154
|
-
def parse_signals()
|
|
155
|
-
meths = self.class.instance_methods()
|
|
154
|
+
# Remember that it will enforce the naming convention: name__signal (two underscores).
|
|
155
|
+
def parse_signals()
|
|
156
|
+
meths = self.class.instance_methods()
|
|
156
157
|
meths.each do |meth|
|
|
157
|
-
meth = meth.to_s #bug fix ruby 1.9 gives stmbol
|
|
158
|
-
glade_name, signal_name = *(meth.split("__"))
|
|
159
|
-
next if (signal_name.to_s == "" or glade_name.to_s == "") #covers nil
|
|
160
|
-
if @builder
|
|
161
|
-
@builder.objects.each do |obj|
|
|
162
|
-
next unless obj.respond_to?(:builder_name)
|
|
163
|
-
if obj.builder_name == glade_name or obj.builder_name =~ /^(?:#{class_name(self)}\.|)#{glade_name}\[[a-zA-Z\d_-]+\]$/ #arrays
|
|
164
|
-
obj.signal_connect(signal_name) { |*args| method(meth.to_sym).call(*args) }
|
|
165
|
-
end
|
|
166
|
-
end
|
|
167
|
-
end
|
|
168
|
-
obj = glade_name == "self" ? self : self.instance_variable_get("@" + glade_name)
|
|
158
|
+
meth = meth.to_s #bug fix ruby 1.9 gives stmbol
|
|
159
|
+
glade_name, signal_name = *(meth.split("__"))
|
|
160
|
+
next if (signal_name.to_s == "" or glade_name.to_s == "") #covers nil
|
|
161
|
+
if @builder
|
|
162
|
+
@builder.objects.each do |obj|
|
|
163
|
+
next unless obj.respond_to?(:builder_name)
|
|
164
|
+
if obj.builder_name == glade_name or obj.builder_name =~ /^(?:#{class_name(self)}\.|)#{glade_name}\[[a-zA-Z\d_-]+\]$/ #arrays
|
|
165
|
+
obj.signal_connect(signal_name) { |*args| method(meth.to_sym).call(*args) }
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
obj = glade_name == "self" ? self : self.instance_variable_get("@" + glade_name)
|
|
169
170
|
obj ||= eval(glade_name) if respond_to?(glade_name) and method(glade_name.to_sym).arity == 0 # no arguments!
|
|
170
|
-
if obj.respond_to?("signal_connect")
|
|
171
|
+
if obj.respond_to?("signal_connect")
|
|
171
172
|
obj.signal_connect(signal_name) { |*args| method(meth.to_sym).call(*args) }
|
|
172
|
-
end
|
|
173
|
-
end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
174
175
|
end
|
|
175
176
|
|
|
176
177
|
# parses instance variables added in before_show
|
|
@@ -184,101 +185,101 @@ module GladeGUI
|
|
|
184
185
|
# end
|
|
185
186
|
# end
|
|
186
187
|
# end
|
|
187
|
-
|
|
188
|
-
# This method is the most useful method to populate a glade form. It will
|
|
189
|
-
# populate from active_record fields and instance variables. It will simply
|
|
190
|
-
# call both of these methods:
|
|
191
|
-
#
|
|
192
|
-
# set_glade_active_record()
|
|
193
|
-
# set_glade_variables()
|
|
194
|
-
#
|
|
195
|
-
# So, to set all the values of a form, simply call the set_glade_all() method instead.
|
|
196
|
-
def set_glade_all(obj = self)
|
|
197
|
-
set_glade_active_record(obj)
|
|
198
|
-
set_glade_variables(obj)
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
# This method is the most useful method to retreive values from a glade form. It will
|
|
202
|
-
# populate from active_record fields and instance variables. It will simply
|
|
203
|
-
# call both of these methods:
|
|
204
|
-
#
|
|
205
|
-
# get_glade_active_record()
|
|
206
|
-
# get_glade_variables()
|
|
207
|
-
#
|
|
208
|
-
# So, to retreive all the values of a form back into your ActiveRecord object and instance variables, simply call the set_glade_all() method instead.
|
|
209
|
-
def get_glade_all(obj = self)
|
|
210
|
-
get_glade_active_record(obj)
|
|
211
|
-
get_glade_variables(obj)
|
|
212
|
-
end
|
|
213
|
-
|
|
214
|
-
|
|
188
|
+
|
|
189
|
+
# This method is the most useful method to populate a glade form. It will
|
|
190
|
+
# populate from active_record fields and instance variables. It will simply
|
|
191
|
+
# call both of these methods:
|
|
192
|
+
#
|
|
193
|
+
# set_glade_active_record()
|
|
194
|
+
# set_glade_variables()
|
|
195
|
+
#
|
|
196
|
+
# So, to set all the values of a form, simply call the set_glade_all() method instead.
|
|
197
|
+
def set_glade_all(obj = self)
|
|
198
|
+
set_glade_active_record(obj)
|
|
199
|
+
set_glade_variables(obj)
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# This method is the most useful method to retreive values from a glade form. It will
|
|
203
|
+
# populate from active_record fields and instance variables. It will simply
|
|
204
|
+
# call both of these methods:
|
|
205
|
+
#
|
|
206
|
+
# get_glade_active_record()
|
|
207
|
+
# get_glade_variables()
|
|
208
|
+
#
|
|
209
|
+
# So, to retreive all the values of a form back into your ActiveRecord object and instance variables, simply call the set_glade_all() method instead.
|
|
210
|
+
def get_glade_all(obj = self)
|
|
211
|
+
get_glade_active_record(obj)
|
|
212
|
+
get_glade_variables(obj)
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
|
|
215
216
|
|
|
216
217
|
# Matches names in glade form to keys in a Hash.
|
|
217
|
-
# @param [Hash] hash The hash with keys that match the names in the glade form.
|
|
218
|
-
def set_glade_hash(hash)
|
|
219
|
-
return unless hash.is_a?(Hash)
|
|
220
|
-
hash.each { |key,val| fill_control( key.to_s, val.to_s) }
|
|
221
|
-
end
|
|
222
|
-
|
|
223
|
-
# Populates the glade form from the instance variables of the class.
|
|
224
|
-
# So instead of having to assign each widget a value:
|
|
225
|
-
#
|
|
226
|
-
# @builder["name"].text = @name
|
|
227
|
-
# @builder["address"].text = @address
|
|
228
|
-
# @builder["email"].text = @eamil
|
|
229
|
-
# @builder["phone"].text = @phone
|
|
230
|
-
#
|
|
231
|
-
# you can write one line of code:
|
|
232
|
-
#
|
|
233
|
-
# set_glade_variables()
|
|
234
|
-
#
|
|
235
|
-
# The optional parameter is seldom used because you usually want the
|
|
236
|
-
# glade form to populate from the calling class. If you passed another object,
|
|
237
|
-
# the form would populate from it.
|
|
238
|
-
#
|
|
239
|
-
# obj - type Object
|
|
240
|
-
#
|
|
241
|
-
def set_glade_variables(obj = self)
|
|
242
|
-
obj.instance_variables.each do |name|
|
|
243
|
-
name = name.to_s #ruby 1.9 passes symbol!
|
|
218
|
+
# @param [Hash] hash The hash with keys that match the names in the glade form.
|
|
219
|
+
def set_glade_hash(hash)
|
|
220
|
+
return unless hash.is_a?(Hash)
|
|
221
|
+
hash.each { |key,val| fill_control( key.to_s, val.to_s) }
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# Populates the glade form from the instance variables of the class.
|
|
225
|
+
# So instead of having to assign each widget a value:
|
|
226
|
+
#
|
|
227
|
+
# @builder["name"].text = @name
|
|
228
|
+
# @builder["address"].text = @address
|
|
229
|
+
# @builder["email"].text = @eamil
|
|
230
|
+
# @builder["phone"].text = @phone
|
|
231
|
+
#
|
|
232
|
+
# you can write one line of code:
|
|
233
|
+
#
|
|
234
|
+
# set_glade_variables()
|
|
235
|
+
#
|
|
236
|
+
# The optional parameter is seldom used because you usually want the
|
|
237
|
+
# glade form to populate from the calling class. If you passed another object,
|
|
238
|
+
# the form would populate from it.
|
|
239
|
+
#
|
|
240
|
+
# obj - type Object
|
|
241
|
+
#
|
|
242
|
+
def set_glade_variables(obj = self)
|
|
243
|
+
obj.instance_variables.each do |name|
|
|
244
|
+
name = name.to_s #ruby 1.9 passes symbol!
|
|
244
245
|
v = obj.instance_variable_get(name)
|
|
245
|
-
name = name.gsub('@', '')
|
|
246
|
-
if v.is_a?(Array)
|
|
247
|
-
v.each_index do |i|
|
|
248
|
-
fill_control("#{name}[#{i.to_s}]", v[i] )
|
|
246
|
+
name = name.gsub('@', '')
|
|
247
|
+
if v.is_a?(Array)
|
|
248
|
+
v.each_index do |i|
|
|
249
|
+
fill_control("#{name}[#{i.to_s}]", v[i] )
|
|
249
250
|
end
|
|
250
251
|
elsif v.is_a?(Hash)
|
|
251
252
|
v.each_pair do |key, val|
|
|
252
253
|
fill_control("#{name}[#{key.to_s}]", val)
|
|
253
|
-
end
|
|
254
|
-
else
|
|
255
|
-
fill_control(name, v)
|
|
256
|
-
end
|
|
257
|
-
end
|
|
258
|
-
end
|
|
259
|
-
|
|
260
|
-
# @private
|
|
261
|
-
def fill_control(glade_name, val)
|
|
254
|
+
end
|
|
255
|
+
else
|
|
256
|
+
fill_control(name, v)
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
# @private
|
|
262
|
+
def fill_control(glade_name, val)
|
|
262
263
|
control = @builder[glade_name]
|
|
263
|
-
control ||= @builder[glade_name.split(".")[1].to_s] # strip class name if there
|
|
264
|
-
return unless control
|
|
265
|
-
case control # order matters-- subclasses?
|
|
266
|
-
when Gtk::Window then control.title = val
|
|
267
|
-
when Gtk::CheckButton then control.active = val
|
|
268
|
-
when Gtk::TextView then control.buffer.text = val.to_s
|
|
264
|
+
control ||= @builder[glade_name.split(".")[1].to_s] # strip class name if there
|
|
265
|
+
return unless control
|
|
266
|
+
case control # order matters-- subclasses?
|
|
267
|
+
when Gtk::Window then control.title = val
|
|
268
|
+
when Gtk::CheckButton then control.active = val
|
|
269
|
+
when Gtk::TextView then control.buffer.text = val.to_s
|
|
269
270
|
when Gtk::Entry then control.text = val.to_s
|
|
270
|
-
when Gtk::ColorButton then control.color = Gdk::Color.parse(val.to_s)
|
|
271
|
-
when Gtk::FontButton then control.font_name = val.to_s
|
|
272
|
-
when Gtk::LinkButton then control.uri = control.label = val.to_s
|
|
273
|
-
when Gtk::Label, Gtk::Button then control.label = val.to_s
|
|
274
|
-
when Gtk::Image then control.file = val.to_s
|
|
275
|
-
when Gtk::SpinButton then control.value = val.to_f
|
|
276
|
-
when Gtk::ProgressBar then control.fraction = val.to_f
|
|
277
|
-
when Gtk::Calendar then control.select_month(val.month, val.year) ; control.select_day(val.day) ; control.mark_day(val.day)
|
|
278
|
-
when Gtk::Adjustment then control.value = val.to_f
|
|
271
|
+
when Gtk::ColorButton then control.color = Gdk::Color.parse(val.to_s)
|
|
272
|
+
when Gtk::FontButton then control.font_name = val.to_s
|
|
273
|
+
when Gtk::LinkButton then control.uri = control.label = val.to_s
|
|
274
|
+
when Gtk::Label, Gtk::Button then control.label = val.to_s
|
|
275
|
+
when Gtk::Image then control.file = val.to_s
|
|
276
|
+
when Gtk::SpinButton then control.value = val.to_f
|
|
277
|
+
when Gtk::ProgressBar then control.fraction = val.to_f
|
|
278
|
+
when Gtk::Calendar then control.select_month(val.month, val.year) ; control.select_day(val.day) ; control.mark_day(val.day)
|
|
279
|
+
when Gtk::Adjustment then control.value = val.to_f
|
|
279
280
|
when Gtk::ScrolledWindow, Gtk::Frame, Gtk::VBox, Gtk::HBox then control.add(val)
|
|
280
|
-
when Gtk::ComboBoxText then try_to_select_text_in_combobox(control, val.to_s)
|
|
281
|
-
end
|
|
281
|
+
when Gtk::ComboBoxText then try_to_select_text_in_combobox(control, val.to_s)
|
|
282
|
+
end
|
|
282
283
|
end
|
|
283
284
|
|
|
284
285
|
def try_to_select_text_in_combobox(cb, text)
|
|
@@ -292,32 +293,32 @@ module GladeGUI
|
|
|
292
293
|
end
|
|
293
294
|
end
|
|
294
295
|
|
|
295
|
-
|
|
296
|
-
#
|
|
297
|
-
# Populates your instance variables from the glade form.
|
|
298
|
-
# This works for Gtk:Button, Gtk::Entry, Gtk::Label and Gtk::Checkbutton.
|
|
299
|
-
# So instead of having to assign instance variable:
|
|
296
|
+
|
|
297
|
+
#
|
|
298
|
+
# Populates your instance variables from the glade form.
|
|
299
|
+
# This works for Gtk:Button, Gtk::Entry, Gtk::Label and Gtk::Checkbutton.
|
|
300
|
+
# So instead of having to assign instance variable:
|
|
300
301
|
#
|
|
301
|
-
# @example
|
|
302
|
-
# @name = @builder["name"].text
|
|
303
|
-
# @address = @builder["address"].text
|
|
304
|
-
# @eamil = @builder["email"].text
|
|
305
|
-
# @phone = @builder["phone"].text
|
|
306
|
-
#
|
|
307
|
-
# You can write one line of code:
|
|
302
|
+
# @example
|
|
303
|
+
# @name = @builder["name"].text
|
|
304
|
+
# @address = @builder["address"].text
|
|
305
|
+
# @eamil = @builder["email"].text
|
|
306
|
+
# @phone = @builder["phone"].text
|
|
307
|
+
#
|
|
308
|
+
# You can write one line of code:
|
|
308
309
|
#
|
|
309
|
-
# @example
|
|
310
|
-
# get_glade_variables()
|
|
311
|
-
#
|
|
312
|
-
# The optional parameter is seldom used because you usually want the
|
|
313
|
-
# glade form to populate from the calling class. If you passed another object,
|
|
314
|
-
# the form would populate from it.
|
|
310
|
+
# @example
|
|
311
|
+
# get_glade_variables()
|
|
312
|
+
#
|
|
313
|
+
# The optional parameter is seldom used because you usually want the
|
|
314
|
+
# glade form to populate from the calling class. If you passed another object,
|
|
315
|
+
# the form would populate from it.
|
|
315
316
|
# @param [Object] obj Any object with instance variables with same names as in galde form.
|
|
316
317
|
# @return none
|
|
317
|
-
def get_glade_variables(obj = self)
|
|
318
|
+
def get_glade_variables(obj = self)
|
|
318
319
|
obj.instance_variables.each do |var_name|
|
|
319
320
|
next if var_name == :@builder or var_name == :@top_level_window
|
|
320
|
-
var = obj.instance_variable_get(var_name)
|
|
321
|
+
var = obj.instance_variable_get(var_name)
|
|
321
322
|
var_name = var_name.to_s.gsub("@", "") #fix for ruby 1.9 giving symbols
|
|
322
323
|
if var.is_a? Hash
|
|
323
324
|
var.each_pair do |key, val|
|
|
@@ -337,65 +338,69 @@ module GladeGUI
|
|
|
337
338
|
glade_value = get_control_value(var_name, obj)
|
|
338
339
|
obj.instance_variable_set("@"+ var_name, glade_value) unless glade_value.nil?
|
|
339
340
|
end
|
|
340
|
-
end
|
|
341
|
-
end
|
|
341
|
+
end
|
|
342
|
+
end
|
|
342
343
|
|
|
343
344
|
# @private
|
|
344
345
|
def get_control_value(glade_name, obj = self)
|
|
345
346
|
control = @builder[glade_name]
|
|
346
347
|
return unless control ||= @builder[class_name(obj) + "." + glade_name]
|
|
347
|
-
case control
|
|
348
|
+
case control
|
|
348
349
|
when Gtk::CheckButton, Gtk::ToggleButton then control.active?
|
|
349
|
-
when Gtk::Entry then control.text
|
|
350
|
-
when Gtk::TextView then control.buffer.text
|
|
350
|
+
when Gtk::Entry then control.text
|
|
351
|
+
when Gtk::TextView then control.buffer.text
|
|
351
352
|
when Gtk::FontButton then control.font_name
|
|
352
|
-
when Gtk::ColorButton then control.color.to_s[0..2] + control.color.to_s[5..6] + control.color.to_s[9..10]
|
|
353
|
-
when Gtk::Label, Gtk::Button then control.label
|
|
354
|
-
when Gtk::SpinButton, Gtk::Adjustment then control.value
|
|
355
|
-
when Gtk::Image then control.file
|
|
356
|
-
when Gtk::ProgressBar then control.fraction
|
|
353
|
+
when Gtk::ColorButton then control.color.to_s[0..2] + control.color.to_s[5..6] + control.color.to_s[9..10]
|
|
354
|
+
when Gtk::Label, Gtk::Button then control.label
|
|
355
|
+
when Gtk::SpinButton, Gtk::Adjustment then control.value
|
|
356
|
+
when Gtk::Image then control.file
|
|
357
|
+
when Gtk::ProgressBar then control.fraction
|
|
357
358
|
when Gtk::Calendar then DateTime.new(*control.date)
|
|
358
|
-
when Gtk::ComboBoxText then control.active_text
|
|
359
|
+
when Gtk::ComboBoxText then control.active_text
|
|
359
360
|
end
|
|
360
361
|
end
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
# @private
|
|
364
|
-
def self.included(obj)
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
# @private
|
|
365
|
+
def self.included(obj)
|
|
366
|
+
lines = caller.select {|line| line.to_s.include? "`<class:" }
|
|
367
|
+
puts "lines[0]:" + lines[0] + "<end>"
|
|
368
|
+
# caller.each {|a| puts a}
|
|
369
|
+
temp = lines[0].split(":") #correct for windows C:\Users\george etc.
|
|
370
|
+
caller_path_to_class_file = temp[0].size == 1 ? temp[0] + ":" + temp[1] : temp[0]
|
|
371
|
+
puts "Path_to_class_file: " + caller_path_to_class_file
|
|
372
|
+
obj.class_eval do
|
|
373
|
+
define_method :my_class_file_path do
|
|
374
|
+
return caller_path_to_class_file
|
|
375
|
+
end
|
|
376
|
+
end
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
# The method you call to show the glade form.
|
|
377
382
|
# It loads the glade form, sets all the form's widgets to your instance variables,
|
|
378
383
|
# connects all your methods to their signals, and starts Gtk.main loop if necessary.
|
|
379
384
|
# @param [Object #builder] parent Optional parent that this window will always be on top of.
|
|
380
|
-
# @return nothing.
|
|
381
|
-
def show_glade(parent = nil)
|
|
382
|
-
load_glade()
|
|
383
|
-
if parent then
|
|
384
|
-
@builder[:window1].transient_for = parent.builder[:window1]
|
|
385
|
-
end
|
|
386
|
-
before_show() if respond_to? :before_show
|
|
387
|
-
parse_signals()
|
|
385
|
+
# @return nothing.
|
|
386
|
+
def show_glade(parent = nil)
|
|
387
|
+
load_glade()
|
|
388
|
+
if parent then
|
|
389
|
+
@builder[:window1].transient_for = parent.builder[:window1]
|
|
390
|
+
end
|
|
391
|
+
before_show() if respond_to? :before_show
|
|
392
|
+
parse_signals()
|
|
388
393
|
set_glade_all()
|
|
389
394
|
@builder[:window1].show #show_all can't hide widgets in before_show
|
|
390
|
-
@top_level_window = Gtk.main_level == 0 ? true : false
|
|
391
|
-
Gtk.main if @top_level_window or @builder[:window1].modal? # need new Gtk.main for blocking!
|
|
392
|
-
end
|
|
395
|
+
@top_level_window = Gtk.main_level == 0 ? true : false
|
|
396
|
+
Gtk.main if @top_level_window or @builder[:window1].modal? # need new Gtk.main for blocking!
|
|
397
|
+
end
|
|
393
398
|
|
|
394
399
|
# Called when window is destroyed when you execute: <tt>@builder[:window1].destroy</tt>
|
|
395
|
-
# It manages the Gtk.main loop for all the windows.
|
|
396
|
-
def window1__destroy(*args)
|
|
397
|
-
Gtk.main_quit if @top_level_window or @builder["window1"].modal?
|
|
398
|
-
end
|
|
400
|
+
# It manages the Gtk.main loop for all the windows.
|
|
401
|
+
def window1__destroy(*args)
|
|
402
|
+
Gtk.main_quit if @top_level_window or @builder["window1"].modal?
|
|
403
|
+
end
|
|
399
404
|
|
|
400
405
|
# Convenience method so you can just make a button named "buttonCancel" and it will work. This
|
|
401
406
|
# method isn't called in code, its triggered by a user clicking a button named "buttonCancel".
|
|
@@ -403,9 +408,9 @@ module GladeGUI
|
|
|
403
408
|
@builder[:window1].destroy
|
|
404
409
|
end
|
|
405
410
|
|
|
406
|
-
def window1__key_press_event(view, evt)
|
|
407
|
-
return unless evt.keyval == Gdk::Keyval::KEY_F8
|
|
408
|
-
oinspect
|
|
411
|
+
def window1__key_press_event(view, evt)
|
|
412
|
+
return unless evt.keyval == Gdk::Keyval::KEY_F8
|
|
413
|
+
oinspect
|
|
409
414
|
end
|
|
410
415
|
|
|
411
416
|
# retrieves the key inside a glade control name. Useful when handling events where
|
|
@@ -420,38 +425,38 @@ module GladeGUI
|
|
|
420
425
|
widget.builder_name.scan(/\[(.+?)\]/).flatten[0]
|
|
421
426
|
end
|
|
422
427
|
|
|
423
|
-
# Populates the glade form from the fields of an ActiveRecord object.
|
|
424
|
-
# So instead of having to assign each widget a value:
|
|
425
|
-
# @example
|
|
426
|
-
# @builder["name"].text = @name
|
|
427
|
-
# @builder["address"].text = @address
|
|
428
|
-
# @builder["email"].text = @eamil
|
|
429
|
-
# @builder["phone"].text = @phone
|
|
430
|
-
#
|
|
431
|
-
# You can write one line of code:
|
|
432
|
-
# @example
|
|
433
|
-
# set_glade_active_record()
|
|
434
|
-
#
|
|
435
|
-
# The optional parameter is seldom used because you usually want the
|
|
436
|
-
# glade form to populate from the calling class. If you passed another object,
|
|
437
|
-
# the form would populate from it.
|
|
438
|
-
#
|
|
439
|
-
# @param [ActiveRecord::Base] obj Any activerecod base object.
|
|
440
|
-
# @return none
|
|
441
|
-
def set_glade_active_record(obj = self)
|
|
442
|
-
return if not defined? obj.attributes
|
|
443
|
-
obj.attributes.each_pair { |key, val| fill_control(class_name(obj) + "." + key, val) }
|
|
428
|
+
# Populates the glade form from the fields of an ActiveRecord object.
|
|
429
|
+
# So instead of having to assign each widget a value:
|
|
430
|
+
# @example
|
|
431
|
+
# @builder["name"].text = @name
|
|
432
|
+
# @builder["address"].text = @address
|
|
433
|
+
# @builder["email"].text = @eamil
|
|
434
|
+
# @builder["phone"].text = @phone
|
|
435
|
+
#
|
|
436
|
+
# You can write one line of code:
|
|
437
|
+
# @example
|
|
438
|
+
# set_glade_active_record()
|
|
439
|
+
#
|
|
440
|
+
# The optional parameter is seldom used because you usually want the
|
|
441
|
+
# glade form to populate from the calling class. If you passed another object,
|
|
442
|
+
# the form would populate from it.
|
|
443
|
+
#
|
|
444
|
+
# @param [ActiveRecord::Base] obj Any activerecod base object.
|
|
445
|
+
# @return none
|
|
446
|
+
def set_glade_active_record(obj = self)
|
|
447
|
+
return if not defined? obj.attributes
|
|
448
|
+
obj.attributes.each_pair { |key, val| fill_control(class_name(obj) + "." + key, val) }
|
|
444
449
|
end
|
|
445
|
-
|
|
446
|
-
def get_glade_active_record(obj)
|
|
447
|
-
return if not defined? obj.attributes
|
|
450
|
+
|
|
451
|
+
def get_glade_active_record(obj)
|
|
452
|
+
return if not defined? obj.attributes
|
|
448
453
|
obj.attributes.each_pair do |key, val|
|
|
449
454
|
new_val = get_control_value(key, obj)
|
|
450
|
-
obj.send("#{key}=", new_val) unless new_val.nil?
|
|
451
|
-
end
|
|
455
|
+
obj.send("#{key}=", new_val) unless new_val.nil?
|
|
456
|
+
end
|
|
452
457
|
end
|
|
453
|
-
|
|
454
|
-
end
|
|
458
|
+
|
|
459
|
+
end
|
|
455
460
|
|
|
456
461
|
|
|
457
462
|
# Waits for all penting events to finish before continuing.
|
|
@@ -459,8 +464,8 @@ def clear_events()
|
|
|
459
464
|
while (Gtk.events_pending?)
|
|
460
465
|
Gtk.main_iteration
|
|
461
466
|
end
|
|
462
|
-
end
|
|
467
|
+
end
|
|
463
468
|
|
|
464
469
|
|
|
465
470
|
|
|
466
|
-
|
|
471
|
+
|
data/lib/SavableClass.rb
CHANGED
data/lib/vrlib.rb
CHANGED
|
@@ -1,12 +1,42 @@
|
|
|
1
1
|
require "gtk3"
|
|
2
|
-
require "require_all"
|
|
3
2
|
require "date"
|
|
4
3
|
require "yaml"
|
|
5
4
|
require "find"
|
|
6
5
|
require "fileutils"
|
|
7
6
|
|
|
8
7
|
|
|
8
|
+
#tools go first
|
|
9
|
+
require_relative "GladeGUI"
|
|
10
|
+
require_relative "Alert"
|
|
11
|
+
require_relative "DragDrop"
|
|
12
|
+
require_relative "SavableClass"
|
|
13
|
+
require_relative "Tools"
|
|
14
|
+
|
|
15
|
+
require_relative "treeview/columns/BlobCol"
|
|
16
|
+
require_relative "treeview/columns/CalendarCol"
|
|
17
|
+
require_relative "treeview/columns/CellRendererCombo"
|
|
18
|
+
require_relative "treeview/columns/CellRendererObject"
|
|
19
|
+
require_relative "treeview/columns/CellRendererProgress"
|
|
20
|
+
require_relative "treeview/columns/CellRendererSpin"
|
|
21
|
+
require_relative "treeview/columns/CellRendererText"
|
|
22
|
+
require_relative "treeview/columns/CellRendererToggle"
|
|
23
|
+
require_relative "treeview/columns/ComboCol"
|
|
24
|
+
require_relative "treeview/columns/CurrencyCol"
|
|
25
|
+
require_relative "treeview/columns/ImageCol"
|
|
26
|
+
require_relative "treeview/columns/ProgressCol"
|
|
27
|
+
require_relative "treeview/columns/SpinCol"
|
|
28
|
+
require_relative "treeview/columns/TreeViewColumn"
|
|
29
|
+
|
|
30
|
+
require_relative "treeview/ViewCommon"
|
|
31
|
+
require_relative "treeview/IterMethods"
|
|
32
|
+
require_relative "treeview/TreeView"
|
|
33
|
+
require_relative "treeview/FileTreeView"
|
|
34
|
+
require_relative "treeview/ListView"
|
|
35
|
+
|
|
36
|
+
#then stuff that relies on tools
|
|
37
|
+
require_relative "oinspect/MethodsListView"
|
|
38
|
+
require_relative "oinspect/ObjectInspectorGUI"
|
|
39
|
+
require_relative "oinspect/VariablesListView"
|
|
40
|
+
|
|
9
41
|
|
|
10
|
-
require_rel '/'
|
|
11
|
-
require_rel 'treeview'
|
|
12
42
|
|
data/src/main/OpenProject.rb
CHANGED
|
@@ -39,16 +39,18 @@ class OpenProject
|
|
|
39
39
|
return unless row = @ftv.selected_rows.first
|
|
40
40
|
return if row[:path] == Dir.pwd #can't delete current project
|
|
41
41
|
if alert("Do you really want to delete \n<b>" + row[:path] + " </b>?",
|
|
42
|
-
parent: self, headline: "Warning!", button_yes: "Delete", button_no: "Cancel", width: 400)
|
|
42
|
+
parent: self, headline: "Warning!", button_yes: "Delete", button_no: "Cancel", width: 400)
|
|
43
43
|
FileUtils.remove_dir(row[:path], true)
|
|
44
|
-
@ftv.refresh()
|
|
44
|
+
@ftv.refresh()
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
def buttonOpen__clicked(*a)
|
|
49
49
|
return unless row = @ftv.selected_rows.first
|
|
50
50
|
test_file = File.join(row[:path], VR_ENV::SETTINGS_FILE)
|
|
51
|
+
puts "Looking for .vr_settings in: " + test_file
|
|
51
52
|
if File.exists?(test_file)
|
|
53
|
+
puts "Opening: " + row[:path]
|
|
52
54
|
@parent.proj_path = row[:path]
|
|
53
55
|
buttonCancel__clicked
|
|
54
56
|
else
|
data/src/version.rb
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION = "3.
|
|
1
|
+
VERSION = "3.6.2"
|
data/vr
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
#!/ruby
|
|
2
|
+
|
|
1
3
|
require "gtk3"
|
|
2
4
|
|
|
3
5
|
def load_everything
|
|
@@ -12,16 +14,34 @@ def load_everything
|
|
|
12
14
|
require "rubygems/package"
|
|
13
15
|
require "rubygems/specification"
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
require_relative 'lib/vrlib'
|
|
18
|
+
|
|
19
|
+
require_relative "src/version"
|
|
20
|
+
|
|
21
|
+
require_relative 'src/editor/VR_TextViewCommon'
|
|
22
|
+
require_relative "src/editor/VR_TextShell"
|
|
23
|
+
require_relative "src/editor/VR_TabSearch"
|
|
24
|
+
require_relative "src/editor/VR_Tabs"
|
|
25
|
+
require_relative "src/editor/VR_Document"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
require_relative "src/main/GemTree"
|
|
29
|
+
require_relative "src/main/NewProjectGUI"
|
|
30
|
+
require_relative "src/main/OpenProject"
|
|
31
|
+
require_relative "src/main/ProjectTree"
|
|
32
|
+
require_relative "src/main/RubygemsAPI"
|
|
33
|
+
require_relative "src/main/VR_ENV_GLOBAL"
|
|
34
|
+
require_relative "src/main/VR_ENV"
|
|
35
|
+
require_relative "src/main/VR_File_Tree"
|
|
36
|
+
require_relative "src/main/VR_Local_Gem_Tree"
|
|
37
|
+
require_relative "src/main/VR_Main"
|
|
38
|
+
require_relative "src/main/VR_Remote_Gem_Tree"
|
|
39
|
+
require_relative "src/main/VR_Tools"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
#require_rel 'src/main'
|
|
16
43
|
|
|
17
|
-
require_relative 'lib/GladeGUI'
|
|
18
|
-
require_relative 'lib/treeview/ViewCommon'
|
|
19
|
-
require_relative 'lib/treeview/ListView'
|
|
20
|
-
require_relative 'lib/treeview/TreeView'
|
|
21
|
-
require_relative 'src/editor/VR_TextViewCommon'
|
|
22
44
|
|
|
23
|
-
require_rel 'lib/'
|
|
24
|
-
require_rel 'src/'
|
|
25
45
|
# require File.exists?("./../../lib/vrlib.rb") ? "./../../lib/vrlib.rb" : "vrlib"
|
|
26
46
|
|
|
27
47
|
# require_rel 'lib/GladeGUI.rb'
|
metadata
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: visualruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.6.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eric Cunningham
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir:
|
|
10
10
|
- "."
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2024-09-26 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: gtk3
|
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
|
17
17
|
requirements:
|
|
18
|
-
- -
|
|
18
|
+
- - ">="
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
|
-
version:
|
|
20
|
+
version: '0'
|
|
21
21
|
type: :runtime
|
|
22
22
|
prerelease: false
|
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
24
|
requirements:
|
|
25
|
-
- -
|
|
25
|
+
- - ">="
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
|
-
version:
|
|
27
|
+
version: '0'
|
|
28
28
|
- !ruby/object:Gem::Dependency
|
|
29
29
|
name: gtksourceview3
|
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
|
31
31
|
requirements:
|
|
32
|
-
- -
|
|
32
|
+
- - ">="
|
|
33
33
|
- !ruby/object:Gem::Version
|
|
34
|
-
version:
|
|
34
|
+
version: '0'
|
|
35
35
|
type: :runtime
|
|
36
36
|
prerelease: false
|
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
|
38
38
|
requirements:
|
|
39
|
-
- -
|
|
39
|
+
- - ">="
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
|
-
version:
|
|
41
|
+
version: '0'
|
|
42
42
|
- !ruby/object:Gem::Dependency
|
|
43
43
|
name: require_all
|
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -65,8 +65,7 @@ extensions: []
|
|
|
65
65
|
extra_rdoc_files: []
|
|
66
66
|
files:
|
|
67
67
|
- "./.vr_settings.yaml"
|
|
68
|
-
- "
|
|
69
|
-
- "./doc/img/logo.png"
|
|
68
|
+
- "./docs/img/logo.png"
|
|
70
69
|
- "./examples/active_record/.vr_settings.yaml"
|
|
71
70
|
- "./examples/active_record/active_record.rb"
|
|
72
71
|
- "./examples/active_record/bin/ChoosePerson.rb"
|
|
@@ -179,12 +178,10 @@ files:
|
|
|
179
178
|
- "./img/ruby.png"
|
|
180
179
|
- "./img/splash.png"
|
|
181
180
|
- "./img/unknown.png"
|
|
182
|
-
- "./lib/ActLikeAHash.rb"
|
|
183
181
|
- "./lib/Alert.rb"
|
|
184
182
|
- "./lib/DragDrop.rb"
|
|
185
183
|
- "./lib/GladeGUI.rb"
|
|
186
184
|
- "./lib/SavableClass.rb"
|
|
187
|
-
- "./lib/SavableHash.rb"
|
|
188
185
|
- "./lib/Tools.rb"
|
|
189
186
|
- "./lib/glade/Alert.glade"
|
|
190
187
|
- "./lib/oinspect/MethodsListView.rb"
|
|
@@ -251,11 +248,11 @@ files:
|
|
|
251
248
|
- "./src/version.rb"
|
|
252
249
|
- "./vr"
|
|
253
250
|
- vr
|
|
254
|
-
homepage:
|
|
251
|
+
homepage: https://github.com/Beagle123/visualruby
|
|
255
252
|
licenses:
|
|
256
253
|
- MIT
|
|
257
254
|
metadata: {}
|
|
258
|
-
post_install_message:
|
|
255
|
+
post_install_message:
|
|
259
256
|
rdoc_options: []
|
|
260
257
|
require_paths:
|
|
261
258
|
- lib
|
|
@@ -270,8 +267,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
270
267
|
- !ruby/object:Gem::Version
|
|
271
268
|
version: '0'
|
|
272
269
|
requirements: []
|
|
273
|
-
rubygems_version: 3.
|
|
274
|
-
signing_key:
|
|
270
|
+
rubygems_version: 3.3.7
|
|
271
|
+
signing_key:
|
|
275
272
|
specification_version: 4
|
|
276
273
|
summary: Create IDE designed to make great GUIs with Ruby
|
|
277
274
|
test_files: []
|
data/.yardoc/my_yard.yaml
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
--- !ruby/object:MyYard
|
|
2
|
-
project_root: "/home/eric/vrp/vr3"
|
|
3
|
-
output_dir: doc
|
|
4
|
-
theme: visualruby
|
|
5
|
-
template: visualruby
|
|
6
|
-
files: lib/**/*.rb
|
|
7
|
-
extra_files: site/*.*
|
|
8
|
-
exclude: ''
|
|
9
|
-
include_public: true
|
|
10
|
-
include_private: false
|
|
11
|
-
include_protected: true
|
|
12
|
-
include_private_tag: false
|
|
13
|
-
title: Visual Ruby
|
|
14
|
-
main: index.html
|
|
15
|
-
export_db: false
|
|
16
|
-
export_db_path: ".yardoc"
|
|
17
|
-
vr_yaml_file: "/home/eric/vrp/vr3/.yardoc/my_yard.yaml"
|
|
18
|
-
builder: !ruby/object:Gtk::Builder {}
|
|
19
|
-
top_level_window: true
|
data/lib/ActLikeAHash.rb
DELETED
data/lib/SavableHash.rb
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
module VR
|
|
3
|
-
|
|
4
|
-
class SavableHash < Hash
|
|
5
|
-
|
|
6
|
-
def init(arg) #either file path or defaults hash
|
|
7
|
-
# if File(arg[:file]).exists
|
|
8
|
-
# return YAML.load(File.open(arg[:file]).read)
|
|
9
|
-
# else
|
|
10
|
-
arg
|
|
11
|
-
# end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def save()
|
|
15
|
-
file = self[:file]
|
|
16
|
-
alert file
|
|
17
|
-
File.open(file, "w") {|f| f.puts(self.to_yaml)}
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
|
/data/{doc → docs}/img/logo.png
RENAMED
|
File without changes
|