visualruby 3.0.22 → 3.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.vr_settings.yaml +15 -19
- data/.yardoc/my_yard.yaml +3 -3
- data/examples/active_record/.vr_settings.yaml +11 -6
- data/examples/active_record/active_record.rb +1 -1
- data/examples/active_record/db/development.sqlite3 +0 -0
- data/examples/active_record2/main.rb +1 -1
- data/examples/alert_box/main.rb +1 -1
- data/examples/all_widgets/main.rb +1 -1
- data/examples/calculator/.vr_settings.yaml +3 -3
- data/examples/calculator/main.rb +1 -1
- data/examples/child_window/main.rb +1 -1
- data/examples/drag_drop/main.rb +1 -1
- data/examples/filetreeview/main.rb +1 -1
- data/examples/listview/bin/SongListView.rb +2 -2
- data/examples/listview_objects/main.rb +1 -1
- data/examples/settings_file/main.rb +1 -1
- data/examples/simple_ruby_gui/main.rb +1 -1
- data/examples/treeview/main.rb +1 -1
- data/lib/DragDrop.rb +1 -45
- data/lib/GladeGUI.rb +79 -99
- data/lib/SavableClass.rb +1 -0
- data/lib/treeview/FileTreeView.rb +23 -19
- data/lib/treeview/columns/TreeViewColumn.rb +1 -1
- data/src/main/GemTree.rb +2 -2
- data/src/main/VR_File_Tree.rb +2 -1
- data/vr +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c9875dc7a7e491c539661b24beb1f82ae9800ff
|
4
|
+
data.tar.gz: cb5116d5521afb53cb20b5c00baeb73b19d92eac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2185e832ea7999cf184a7967d5b58a0b7f799d67938cd2d7389eba8653969ce841cb9e674176f64ad58f3841364a8787fa50ed87bb7b013427d7e7266b1fdf2d
|
7
|
+
data.tar.gz: 46a0b8df4685f384fe99ea0724c0f111a8cf46b46dd5818ea7103115af5bb144accfc459d76d5c21f9b10341609f10901056a3765182e96215020ef79bfe6602
|
data/.vr_settings.yaml
CHANGED
@@ -2,34 +2,30 @@
|
|
2
2
|
vr_yaml_file: "/home/eric/vrp/vr3/.vr_settings.yaml"
|
3
3
|
width: 1364
|
4
4
|
height: 691
|
5
|
-
panel_pos:
|
5
|
+
panel_pos: 300
|
6
6
|
notebook_panel_position: 472
|
7
7
|
run_command_line: ruby vr
|
8
8
|
open_files:
|
9
|
+
- "/home/eric/vrp/vr3/lib/SavableClass.rb"
|
10
|
+
- "/home/eric/vrp/vr3/README.md"
|
11
|
+
- "/home/eric/vrp/vr3/site/Signals_Tutorial.rdoc"
|
12
|
+
- "/home/eric/vrp/vr3/vr"
|
9
13
|
- "/home/eric/vrp/vr3/src/main/VR_Main.rb"
|
10
|
-
- "/home/eric/vrp/vr3/
|
14
|
+
- "/home/eric/vrp/vr3/examples/listview/bin/SongListView.rb"
|
15
|
+
- "/home/eric/vrp/vr3/src/main/GemTree.rb"
|
16
|
+
- "/home/eric/vrp/vr3/lib/treeview/FileTreeView.rb"
|
17
|
+
- "/home/eric/vrp/vr3/lib/treeview/columns/TreeViewColumn.rb"
|
18
|
+
- "/home/eric/vrp/vr3/lib/treeview/ListView.rb"
|
11
19
|
- "/home/eric/vrp/vr3/lib/treeview/ViewCommon.rb"
|
12
|
-
- "/home/eric/vrp/vr3/
|
13
|
-
- "/home/eric/vrp/vr3/lib/
|
14
|
-
- "/home/eric/vrp/vr3/lib/vrlib.rb"
|
15
|
-
- "/home/eric/vrp/vr3/vr"
|
16
|
-
- "/home/eric/vrp/vr3/lib/Alert.rb"
|
17
|
-
- "/home/eric/vrp/vr3/README.md"
|
18
|
-
- "/home/eric/vrp/vr3/examples/active_record/bin/Person.rb"
|
19
|
-
- "/home/eric/vrp/vr3/examples/active_record/active_record.rb"
|
20
|
-
- "/home/eric/vrp/vr3/src/main/VR_ENV.rb"
|
21
|
-
- "/home/eric/vrp/vr3/vr.gemspec"
|
22
|
-
- "/home/eric/vrp/vr3/examples/phantom/main.rb"
|
23
|
-
- "/home/eric/vrp/vr3/examples/phantom/src/MyClass.rb"
|
20
|
+
- "/home/eric/vrp/vr3/lib/treeview/columns/ComboCol.rb"
|
21
|
+
- "/home/eric/vrp/vr3/lib/treeview/columns/ImageCol.rb"
|
24
22
|
open_folders:
|
25
23
|
- "/home/eric/vrp/vr3"
|
26
|
-
- "/home/eric/vrp/vr3/
|
27
|
-
- "/home/eric/vrp/vr3/examples/phantom"
|
28
|
-
- "/home/eric/vrp/vr3/examples/phantom/src"
|
24
|
+
- "/home/eric/vrp/vr3/site"
|
29
25
|
- "/home/eric/vrp/vr3/src"
|
30
26
|
- "/home/eric/vrp/vr3/src/main"
|
31
|
-
current_file: "/home/eric/vrp/vr3/
|
32
|
-
current_line:
|
27
|
+
current_file: "/home/eric/vrp/vr3/lib/treeview/columns/ImageCol.rb"
|
28
|
+
current_line: 4
|
33
29
|
rdoc_command_line: yardoc lib - site/*.*
|
34
30
|
builder: !ruby/object:Gtk::Builder {}
|
35
31
|
top_level_window: false
|
data/.yardoc/my_yard.yaml
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:MyYard
|
2
2
|
project_root: "/home/eric/vrp/vr3"
|
3
3
|
output_dir: doc
|
4
|
-
theme:
|
5
|
-
template:
|
4
|
+
theme: visualruby
|
5
|
+
template: visualruby
|
6
6
|
files: lib/**/*.rb
|
7
7
|
extra_files: site/*.*
|
8
8
|
exclude: ''
|
9
9
|
include_public: true
|
10
10
|
include_private: false
|
11
|
-
include_protected:
|
11
|
+
include_protected: true
|
12
12
|
include_private_tag: false
|
13
13
|
title: Visual Ruby
|
14
14
|
main: index.html
|
@@ -1,14 +1,19 @@
|
|
1
1
|
--- !ruby/object:VR_ENV
|
2
2
|
vr_yaml_file: "/home/eric/vrp/vr3/examples/active_record/.vr_settings.yaml"
|
3
|
-
width:
|
4
|
-
height:
|
3
|
+
width: 1197
|
4
|
+
height: 641
|
5
5
|
panel_pos: 360
|
6
6
|
notebook_panel_position: 400
|
7
|
-
run_command_line: ruby
|
7
|
+
run_command_line: ruby active_record.rb
|
8
8
|
open_files:
|
9
|
-
- "/home/eric/vrp/vr3/
|
9
|
+
- "/home/eric/vrp/vr3/examples/active_record/active_record.rb"
|
10
|
+
- "/home/eric/vrp/vr3/examples/active_record/bin/Person.rb"
|
10
11
|
open_folders:
|
11
12
|
- "/home/eric/vrp/vr3/examples/active_record"
|
12
|
-
|
13
|
-
|
13
|
+
- "/home/eric/vrp/vr3/examples/active_record/bin"
|
14
|
+
- "/home/eric/vrp/vr3/examples/active_record/bin/glade"
|
15
|
+
current_file: "/home/eric/vrp/vr3/examples/active_record/bin/Person.rb"
|
16
|
+
current_line: 3
|
14
17
|
rdoc_command_line: rdoc -x README
|
18
|
+
builder: !ruby/object:Gtk::Builder {}
|
19
|
+
top_level_window: false
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
|
3
3
|
# ignore -- this is for development, same as require 'vrlib'
|
4
|
-
require File.exists?("./../../
|
4
|
+
require File.exists?("./../../lib/vrlib.rb") ? "./../../lib/vrlib.rb" : "vrlib"
|
5
5
|
|
6
6
|
begin
|
7
7
|
require 'active_record'
|
Binary file
|
data/examples/alert_box/main.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
3
|
# ignore -- this is for development, same as require 'vrlib'
|
4
|
-
require File.exists?("./../../
|
4
|
+
require File.exists?("./../../lib/vrlib.rb") ? "./../../lib/vrlib.rb" : "vrlib"
|
5
5
|
|
6
6
|
# from require_all gem:
|
7
7
|
require_rel 'bin/'
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
# ignore -- this is for development, same as require 'vrlib'
|
5
|
-
require File.exists?("./../../
|
5
|
+
require File.exists?("./../../lib/vrlib.rb") ? "./../../lib/vrlib.rb" : "vrlib"
|
6
6
|
|
7
7
|
# from require_all gem:
|
8
8
|
require_rel 'bin/'
|
@@ -1,7 +1,9 @@
|
|
1
1
|
--- !ruby/object:VR_ENV
|
2
|
+
vr_yaml_file: "/home/eric/vrp/vr3/examples/calculator/.vr_settings.yaml"
|
2
3
|
width: 1028
|
3
4
|
height: 691
|
4
5
|
panel_pos: 365
|
6
|
+
notebook_panel_position: 400
|
5
7
|
run_command_line: ruby main.rb
|
6
8
|
open_files:
|
7
9
|
- "/home/eric/vrp/vr3/examples/calculator/main.rb"
|
@@ -10,9 +12,7 @@ open_folders:
|
|
10
12
|
- "/home/eric/vrp/vr3/examples/calculator"
|
11
13
|
- "/home/eric/vrp/vr3/examples/calculator/bin"
|
12
14
|
current_file: "/home/eric/vrp/vr3/examples/calculator/bin/Calculator.rb"
|
13
|
-
rdoc_command_line: rdoc -x README
|
14
|
-
vr_yaml_file: ".vr_settings.yaml"
|
15
|
-
notebook_panel_position: 400
|
16
15
|
current_line: 65
|
16
|
+
rdoc_command_line: rdoc -x README
|
17
17
|
settings_file_version: 1
|
18
18
|
filename: ".vr_settings.yaml"
|
data/examples/calculator/main.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# Updated for Gtk3!
|
4
4
|
|
5
5
|
# ignore -- this is for development, same as require 'vrlib'
|
6
|
-
require File.exists?("./../../
|
6
|
+
require File.exists?("./../../lib/vrlib.rb") ? "./../../lib/vrlib.rb" : "vrlib"
|
7
7
|
|
8
8
|
# from require_all gem:
|
9
9
|
require_rel 'bin/'
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#Updated for Gtk3!
|
4
4
|
|
5
5
|
# ignore -- this is for development, same as require 'vrlib'
|
6
|
-
require File.exists?("./../../
|
6
|
+
require File.exists?("./../../lib/vrlib.rb") ? "./../../lib/vrlib.rb" : "vrlib"
|
7
7
|
|
8
8
|
# from require_all gem:
|
9
9
|
require_rel 'bin/'
|
data/examples/drag_drop/main.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
3
|
# ignore -- this is for development, same as require 'vrlib'
|
4
|
-
require File.exists?("./../../
|
4
|
+
require File.exists?("./../../lib/vrlib.rb") ? "./../../lib/vrlib.rb" : "vrlib"
|
5
5
|
|
6
6
|
# from require_all gem:
|
7
7
|
require_rel 'bin/'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
3
|
# ignore -- this is for development, same as require 'vrlib'
|
4
|
-
require File.exists?("./../../
|
4
|
+
require File.exists?("./../../lib/vrlib.rb") ? "./../../lib/vrlib.rb" : "vrlib"
|
5
5
|
require 'find'
|
6
6
|
|
7
7
|
|
@@ -8,12 +8,12 @@
|
|
8
8
|
class SongListView < VR::ListView
|
9
9
|
|
10
10
|
|
11
|
-
AUDIO_ICON = Gdk::Pixbuf.new(File.dirname(__FILE__) + "/audio-x-generic.png")
|
11
|
+
AUDIO_ICON = Gdk::Pixbuf.new(:file => File.dirname(__FILE__) + "/audio-x-generic.png")
|
12
12
|
|
13
13
|
|
14
14
|
def initialize
|
15
15
|
@cols = {}
|
16
|
-
@cols[:pix] = {:pix =>
|
16
|
+
@cols[:pix] = {:pix => GdkPixbuf::Pixbuf, :song => String } #two renderers in this column
|
17
17
|
@cols[:date] = VR::Col::CalendarCol # DateTime
|
18
18
|
@cols[:artist] = String
|
19
19
|
@cols[:first_name] = String
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Updated for Gtk3!
|
4
4
|
|
5
5
|
# ignore -- this is for development, same as require 'vrlib'
|
6
|
-
require File.exists?("./../../
|
6
|
+
require File.exists?("./../../lib/vrlib.rb") ? "./../../lib/vrlib.rb" : "vrlib"
|
7
7
|
|
8
8
|
# from require_all gem:
|
9
9
|
require_rel 'bin/'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
3
|
# ignore -- this is for development, same as require 'vrlib'
|
4
|
-
require File.exists?("./../../
|
4
|
+
require File.exists?("./../../lib/vrlib.rb") ? "./../../lib/vrlib.rb" : "vrlib"
|
5
5
|
|
6
6
|
|
7
7
|
# from require_all gem:
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#Updated for Gtk3!
|
4
4
|
|
5
5
|
# ignore -- this is for development, same as require 'vrlib'
|
6
|
-
require File.exists?("./../../
|
6
|
+
require File.exists?("./../../lib/vrlib.rb") ? "./../../lib/vrlib.rb" : "vrlib"
|
7
7
|
|
8
8
|
# from require_all gem:
|
9
9
|
require_rel 'bin/'
|
data/examples/treeview/main.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
#Updated for Gtk3!
|
4
4
|
|
5
5
|
# ignore -- this is for development, same as: require 'vrlib'
|
6
|
-
require File.exists?("./../../
|
6
|
+
require File.exists?("./../../lib/vrlib.rb") ? "./../../lib/vrlib.rb" : "vrlib"
|
7
7
|
|
8
8
|
# from require_all gem:
|
9
9
|
require_rel 'bin/'
|
data/lib/DragDrop.rb
CHANGED
@@ -41,49 +41,5 @@ module VR
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
|
-
#
|
46
|
-
# attr_accessor :dragged_widget, :drag_array
|
47
|
-
#
|
48
|
-
# def drag_array(element = nil)
|
49
|
-
# @dnd ||= []
|
50
|
-
# @dnd.push(element) if not element.nil?
|
51
|
-
# return @dnd
|
52
|
-
# end
|
53
|
-
#
|
54
|
-
#
|
55
|
-
# def drag_to(target_widget) #Gdk::Window::BUTTON1_MASK)
|
56
|
-
#
|
57
|
-
# @target_widgets ||= []
|
58
|
-
# @target_widgets << target_widget
|
59
|
-
#
|
60
|
-
## @drag_array ||= []
|
61
|
-
## @drag_array <<
|
62
|
-
#
|
63
|
-
# ar = [[ self.object_id.to_s, :same_app, 12_345]]
|
64
|
-
# drag_source_set(Gdk::ModifierType::BUTTON1_MASK |
|
65
|
-
# Gdk::ModifierType::BUTTON2_MASK,
|
66
|
-
# ar,
|
67
|
-
# Gdk::DragAction::COPY |
|
68
|
-
# Gdk::DragAction::MOVE)
|
69
|
-
#
|
70
|
-
# ar = target_widget.drag_array([ self.object_id.to_s, :same_app, 12_345])
|
71
|
-
# target_widget.drag_dest_set(Gtk::DestDefaults::MOTION |
|
72
|
-
# Gtk::DestDefaults::HIGHLIGHT,
|
73
|
-
# ar,
|
74
|
-
# Gdk::DragAction::COPY |
|
75
|
-
# Gdk::DragAction::MOVE)
|
76
|
-
#
|
77
|
-
# if not @done
|
78
|
-
# @done = true
|
79
|
-
# self.signal_connect("drag_begin") do |widget, context|
|
80
|
-
# @target_widgets.each { |widg| widg.dragged_widget = self }
|
81
|
-
# end
|
82
|
-
# end
|
83
|
-
#
|
84
|
-
# end
|
85
|
-
#
|
86
|
-
# end
|
87
|
-
#
|
88
|
-
#end
|
44
|
+
|
89
45
|
|
data/lib/GladeGUI.rb
CHANGED
@@ -82,54 +82,51 @@
|
|
82
82
|
# set_glade_variables() method.)
|
83
83
|
module GladeGUI
|
84
84
|
|
85
|
-
# @!attribute [rw] builder
|
86
|
-
# @return [Gtk::Builder] The builder that holds references to everything in the glade form.
|
85
|
+
# @!attribute [rw] builder
|
86
|
+
# @return [Gtk::Builder] The builder that holds references to everything in the glade form.
|
87
87
|
attr_accessor :builder
|
88
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
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
src.extend(VR::Draggable) unless src.is_a?(VR::Draggable)
|
108
|
-
src.add_target_widget(target)
|
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
|
109
107
|
end
|
110
|
-
end
|
111
108
|
|
112
109
|
|
113
110
|
|
114
|
-
##
|
115
|
-
# This will Load the glade form according to the naming convention:
|
116
|
-
# MyClass.rb => MyClass.glade.
|
117
|
-
# It will create a Gtk::Builder object from your glade file.
|
118
|
-
# The Gtk::Builder object is stored in the instance variable, @builder.
|
119
|
-
# You can get a reference to any of the widgets on the glade form by
|
120
|
-
# using the @builder object:
|
121
|
-
#
|
122
|
-
# @example
|
123
|
-
# widget = @builder["name"]
|
124
|
-
#
|
125
|
-
# Normally, you should give your widgets names of instance variables: i.e. @email
|
126
|
-
# so they can be autoloaded when the glade form is shown using the #show_glade method. For example,
|
127
|
-
# the value of the @email vaiable would be loaded into a Gtk:Entry named "email"
|
128
|
-
# in your glade form. It saves you from having to do this:
|
129
|
-
#
|
130
|
-
# @example
|
131
|
-
# @builder[:email].text = @email
|
132
|
-
#
|
111
|
+
##
|
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:
|
118
|
+
#
|
119
|
+
# @example
|
120
|
+
# widget = @builder["name"]
|
121
|
+
#
|
122
|
+
# Normally, you should give your widgets names of instance variables: i.e. @email
|
123
|
+
# so they can be autoloaded when the glade form is shown using the #show_glade method. For example,
|
124
|
+
# the value of the @email vaiable would be loaded into a Gtk:Entry named "email"
|
125
|
+
# in your glade form. It saves you from having to do this:
|
126
|
+
#
|
127
|
+
# @example
|
128
|
+
# @builder[:email].text = @email
|
129
|
+
#
|
133
130
|
def load_glade()
|
134
131
|
caller__FILE__ = my_class_file_path()
|
135
132
|
file_name = File.join(File.split(caller__FILE__)[0] , "glade", class_name(self) + ".glade")
|
@@ -214,28 +211,7 @@ end
|
|
214
211
|
get_glade_variables(obj)
|
215
212
|
end
|
216
213
|
|
217
|
-
|
218
|
-
# So instead of having to assign each widget a value:
|
219
|
-
# @example
|
220
|
-
# @builder["name"].text = @name
|
221
|
-
# @builder["address"].text = @address
|
222
|
-
# @builder["email"].text = @eamil
|
223
|
-
# @builder["phone"].text = @phone
|
224
|
-
#
|
225
|
-
# You can write one line of code:
|
226
|
-
# @example
|
227
|
-
# set_glade_active_record()
|
228
|
-
#
|
229
|
-
# The optional parameter is seldom used because you usually want the
|
230
|
-
# glade form to populate from the calling class. If you passed another object,
|
231
|
-
# the form would populate from it.
|
232
|
-
#
|
233
|
-
# @param [ActiveRecord::Base] obj Any activerecod base object.
|
234
|
-
# @return none
|
235
|
-
def set_glade_active_record(obj = self)
|
236
|
-
return if not defined? @attributes
|
237
|
-
obj.attributes.each_pair { |key, val| fill_control(class_name(obj) + "." + key, val) }
|
238
|
-
end
|
214
|
+
|
239
215
|
|
240
216
|
# Matches names in glade form to keys in a Hash.
|
241
217
|
# @param [Hash] hash The hash with keys that match the names in the glade form.
|
@@ -283,7 +259,8 @@ end
|
|
283
259
|
|
284
260
|
# @private
|
285
261
|
def fill_control(glade_name, val)
|
286
|
-
control = @builder[glade_name]
|
262
|
+
control = @builder[glade_name]
|
263
|
+
control ||= @builder[glade_name.split(".")[1].to_s] # strip class name if there
|
287
264
|
return unless control
|
288
265
|
case control # order matters-- subclasses?
|
289
266
|
when Gtk::Window then control.title = val
|
@@ -365,13 +342,14 @@ end
|
|
365
342
|
|
366
343
|
# @private
|
367
344
|
def get_control_value(glade_name, obj = self)
|
368
|
-
|
345
|
+
control = @builder[glade_name]
|
346
|
+
return unless control ||= @builder[class_name(obj) + "." + glade_name]
|
369
347
|
case control
|
370
348
|
when Gtk::CheckButton, Gtk::ToggleButton then control.active?
|
371
349
|
when Gtk::Entry then control.text
|
372
350
|
when Gtk::TextView then control.buffer.text
|
373
351
|
when Gtk::FontButton then control.font_name
|
374
|
-
when Gtk::ColorButton then control.color.to_s[0..2] + control.color.to_s[5..6] + control.color.to_s[9..10]
|
352
|
+
when Gtk::ColorButton then control.color.to_s[0..2] + control.color.to_s[5..6] + control.color.to_s[9..10]
|
375
353
|
when Gtk::Label, Gtk::Button then control.label
|
376
354
|
when Gtk::SpinButton, Gtk::Adjustment then control.value
|
377
355
|
when Gtk::Image then control.file
|
@@ -381,25 +359,6 @@ end
|
|
381
359
|
end
|
382
360
|
end
|
383
361
|
|
384
|
-
def get_glade_active_record(obj)
|
385
|
-
return if not defined? @attributes
|
386
|
-
obj.attributes.each_pair do |key, val|
|
387
|
-
control = @builder[class_name(obj) + "." + key]
|
388
|
-
control ||= @builder[key]
|
389
|
-
case control
|
390
|
-
when Gtk::CheckButton then self.send("#{key}=", control.active?)
|
391
|
-
when Gtk::Entry then self.send("#{key}=", control.text)
|
392
|
-
when Gtk::TextView then self.send("#{key}=", control.buffer.text)
|
393
|
-
when Gtk::FontButton then self.send("#{key}=", control.font_name)
|
394
|
-
when Gtk::Label, Gtk::Button then self.send("#{key}=", control.label)
|
395
|
-
when Gtk::SpinButton then self.send("#{key}=", control.value)
|
396
|
-
when Gtk::Image then self.send("#{key}=", control.file)
|
397
|
-
when Gtk::ProgressBar then self.send("#{key}=", control.fraction)
|
398
|
-
when Gtk::Calendar then self.send("#{key}=", DateTime.new(*control.date))
|
399
|
-
when Gtk::Adjustment then self.send("#{key}=", control.value)
|
400
|
-
end
|
401
|
-
end
|
402
|
-
end
|
403
362
|
|
404
363
|
# @private
|
405
364
|
def self.included(obj)
|
@@ -461,18 +420,36 @@ end
|
|
461
420
|
widget.builder_name[/\[.+?\]/]
|
462
421
|
end
|
463
422
|
|
464
|
-
|
465
|
-
#
|
466
|
-
#
|
467
|
-
#
|
468
|
-
#
|
469
|
-
#
|
470
|
-
#
|
471
|
-
#
|
472
|
-
#
|
473
|
-
#
|
474
|
-
#
|
475
|
-
|
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) }
|
444
|
+
end
|
445
|
+
|
446
|
+
def get_glade_active_record(obj)
|
447
|
+
return if not defined? obj.attributes
|
448
|
+
obj.attributes.each_pair do |key, val|
|
449
|
+
new_val = get_control_value(key, obj)
|
450
|
+
obj.send("#{key}=", new_val) unless new_val.nil?
|
451
|
+
end
|
452
|
+
end
|
476
453
|
|
477
454
|
end
|
478
455
|
|
@@ -483,4 +460,7 @@ def clear_events()
|
|
483
460
|
Gtk.main_iteration
|
484
461
|
end
|
485
462
|
end
|
486
|
-
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
|
data/lib/SavableClass.rb
CHANGED
@@ -28,6 +28,7 @@ module VR
|
|
28
28
|
# make another copy of the yaml file.
|
29
29
|
def self.save_yaml(obj, file_name = nil)
|
30
30
|
file_name ||= obj.instance_variable_get(:@vr_yaml_file)
|
31
|
+
@vr_yaml_file = file_name
|
31
32
|
dir = File.dirname(file_name)
|
32
33
|
unless File.directory?(dir)
|
33
34
|
FileUtils.mkdir_p(dir)
|
@@ -21,15 +21,19 @@ module VR
|
|
21
21
|
@root = File.expand_path(root)
|
22
22
|
@glob = glob
|
23
23
|
@validate_block = validate_block
|
24
|
-
super(:file => {:pix =>
|
24
|
+
super(:file => {:pix => GdkPixbuf::Pixbuf, :file_name => String}, :empty => TrueClass,
|
25
25
|
:path => String, :sort_on => String)
|
26
26
|
col_visible( :path => false, :sort_on => false, :empty => false)
|
27
27
|
self.headers_visible = false
|
28
28
|
@icons = File.directory?(icon_path) ? IconHash.new(icon_path) : nil
|
29
|
-
parse_signals() #fix this! Subclasses may call twice!
|
29
|
+
# parse_signals() #fix this! Subclasses may call twice!
|
30
30
|
model.set_sort_column_id(id(:sort_on), :ascending )
|
31
31
|
self.set_enable_search(false)
|
32
32
|
refresh
|
33
|
+
self.signal_connect("row_expanded") { |view, iter, path|
|
34
|
+
iter = model.get_iter(path) # bug fix
|
35
|
+
fill_folder(iter) if iter[id(:empty)]
|
36
|
+
}
|
33
37
|
self.visible = true # necessary!
|
34
38
|
end
|
35
39
|
|
@@ -54,15 +58,17 @@ module VR
|
|
54
58
|
files = files.select &@validate_block if @validate_block
|
55
59
|
files.each do |fn|
|
56
60
|
add_file(fn, parent_iter)
|
57
|
-
end
|
61
|
+
end
|
62
|
+
expand_row(parent_iter.path, false)
|
58
63
|
end
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
64
|
+
|
65
|
+
# Phased out. Don't want to use parse_signals() because user might call it twice causing two calls to method.
|
66
|
+
# #Ignore this, it is called when a folder is clicked, and expands the folder.
|
67
|
+
# def self__row_expanded(view, iter, path)
|
68
|
+
# iter = model.get_iter(path) #bug fix
|
69
|
+
# fill_folder(iter) if iter[id(:empty)]
|
70
|
+
# expand_row(iter.path, false)
|
71
|
+
# end
|
66
72
|
|
67
73
|
# Expands or collapses the currently selected row
|
68
74
|
def expand_or_collapse_folder()
|
@@ -70,7 +76,7 @@ module VR
|
|
70
76
|
if row_expanded?(row.path)
|
71
77
|
collapse_row(row.path)
|
72
78
|
else
|
73
|
-
|
79
|
+
expand_row(row.path, false)
|
74
80
|
end
|
75
81
|
end
|
76
82
|
|
@@ -88,7 +94,9 @@ module VR
|
|
88
94
|
def open_folders(folder_paths)
|
89
95
|
model.each do |model, path, iter|
|
90
96
|
if folder_paths.include?(iter[id(:path)])
|
91
|
-
|
97
|
+
fill_folder(iter)
|
98
|
+
# expand_row(path, false)
|
99
|
+
# self__row_expanded(self, iter, path)
|
92
100
|
end
|
93
101
|
end
|
94
102
|
end
|
@@ -142,7 +150,7 @@ module VR
|
|
142
150
|
def initialize(path)
|
143
151
|
Dir.glob(path + "/*.png").each do |f|
|
144
152
|
ext = File.basename(f, ".png")
|
145
|
-
self[ext] =
|
153
|
+
self[ext] = GdkPixbuf::Pixbuf.new(:file => f)
|
146
154
|
end
|
147
155
|
end
|
148
156
|
|
@@ -151,13 +159,9 @@ module VR
|
|
151
159
|
self.has_key?(ext) ? self[ext] : self["unknown"]
|
152
160
|
end
|
153
161
|
end
|
154
|
-
|
155
|
-
|
162
|
+
|
156
163
|
end
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
164
|
+
|
161
165
|
end
|
162
166
|
|
163
167
|
|
@@ -11,7 +11,7 @@ module VR::Col
|
|
11
11
|
cols.each_pair do |symb, type|
|
12
12
|
r = nil
|
13
13
|
a = [model_col, self, @view, symb]
|
14
|
-
if type ==
|
14
|
+
if type == GdkPixbuf::Pixbuf # ok to use gtk
|
15
15
|
r = Gtk::CellRendererPixbuf.new #(*a)
|
16
16
|
self.pack_start( r, false )
|
17
17
|
self.add_attribute( r, :pixbuf, model_col)
|
data/src/main/GemTree.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
|
2
2
|
class GemTree < VR::ListView
|
3
3
|
|
4
|
-
RUBY_ICON =
|
4
|
+
RUBY_ICON = GdkPixbuf::Pixbuf.new(:file => File.dirname(__FILE__) + '/../../img/rb.png')
|
5
5
|
|
6
6
|
def initialize()
|
7
|
-
hash = {:gems => {:pix =>
|
7
|
+
hash = {:gems => {:pix => GdkPixbuf::Pixbuf, :gem => String}}
|
8
8
|
super(hash)
|
9
9
|
self.headers_visible = false
|
10
10
|
@api = RubygemsAPI.new
|
data/src/main/VR_File_Tree.rb
CHANGED
data/vr
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: visualruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Cunningham
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir:
|
10
10
|
- "."
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-09-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gtk3
|