visualruby 3.0.10 → 3.0.11
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 +19 -12
- data/bin/main/VR_File_Tree.rb +6 -4
- data/vrlib/lib/Alert.rb +35 -47
- data/vrlib/lib/GladeGUI.rb +97 -95
- data/vrlib/lib/treeview/FileTreeView.rb +43 -23
- data/vrlib/lib/treeview/ListView.rb +21 -21
- data/vrlib/rdoc_replace.yaml +7 -19
- metadata +2 -5
- data/examples/alert_box/.vr_settings.yaml +0 -17
- data/examples/settings_file/.vr_settings.yaml +0 -24
- data/vrlib/.vr_settings.yaml +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7db31ad34e0e7b2513be6233c8114076d23ec55d
|
4
|
+
data.tar.gz: 636fe8b6150eb4d660aee38d868bb5eaca3f3c6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f5897f76551d4c65420d3c4476c210154e0f724add59be939f9a7e5cd701b4a0657768204d96fe9320999c66b573d408ce1cd88a34ff07f4145d89fa49a79ac
|
7
|
+
data.tar.gz: 6ba18aa633a78c2ab3eb3b42fa98f0dcbe96d497daab6c7d53cf95c02d42f9d42e8630212438daec3349acc79fc3dbdccd69216d5664311656985c42c9a8362d
|
data/.vr_settings.yaml
CHANGED
@@ -1,19 +1,26 @@
|
|
1
1
|
--- !ruby/object:VR_ENV
|
2
|
-
|
3
|
-
|
2
|
+
vr_yaml_file: ".vr_settings.yaml"
|
3
|
+
width: 1364
|
4
|
+
height: 691
|
4
5
|
panel_pos: 360
|
5
|
-
|
6
|
+
notebook_panel_position: 400
|
7
|
+
run_command_line: ruby vr
|
6
8
|
open_files:
|
7
|
-
- "/home/eric/vrp/vr3/
|
8
|
-
- "/home/eric/vrp/vr3/
|
9
|
-
- "/home/eric/vrp/vr3/vrlib/
|
10
|
-
- "/home/eric/vrp/vr3/
|
9
|
+
- "/home/eric/vrp/vr3/vrlib/yard_hack/common.css"
|
10
|
+
- "/home/eric/vrp/vr3/vrlib/README.md"
|
11
|
+
- "/home/eric/vrp/vr3/vrlib/doc/top-level-namespace.html"
|
12
|
+
- "/home/eric/vrp/vr3/vrlib/doc/method_list.html"
|
13
|
+
- "/home/eric/vrp/vr3/vrlib/doc/class_list.html"
|
11
14
|
open_folders:
|
12
15
|
- "/home/eric/vrp/vr3"
|
13
16
|
- "/home/eric/vrp/vr3/bin"
|
14
17
|
- "/home/eric/vrp/vr3/bin/main"
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
- "/home/eric/vrp/vr3/vrlib"
|
19
|
+
- "/home/eric/vrp/vr3/vrlib/doc"
|
20
|
+
- "/home/eric/vrp/vr3/vrlib/doc/css"
|
21
|
+
- "/home/eric/vrp/vr3/vrlib/yard_hack"
|
22
|
+
current_file: "/home/eric/vrp/vr3/vrlib/doc/top-level-namespace.html"
|
23
|
+
current_line: 435
|
24
|
+
rdoc_command_line: yardoc - site/*.md
|
25
|
+
builder: !ruby/object:Gtk::Builder {}
|
26
|
+
top_level_window: false
|
data/bin/main/VR_File_Tree.rb
CHANGED
@@ -55,8 +55,11 @@ class VR_File_Tree < VR::FileTreeView
|
|
55
55
|
FileUtils.cd(fn)
|
56
56
|
@main.shell.buffer.text = $VR_ENV.rdoc_command_line + fn + "\n"
|
57
57
|
@main.shell.buffer.text += `#{$VR_ENV.rdoc_command_line} 2>&1`
|
58
|
-
VR_Tools.replace_html_in_docs()
|
59
|
-
FileUtils.
|
58
|
+
VR_Tools.replace_html_in_docs()
|
59
|
+
FileUtils.copy("yard_hack/common.css", "#{fn}/doc/css/common.css") if File.exists?("yard_hack/common.css")
|
60
|
+
FileUtils.copy("yard_hack/index.html", "#{fn}/doc/index.html") if File.exists?("yard_hack/index.html")
|
61
|
+
FileUtils.copy("yard_hack/index.html", "#{fn}/doc/frames.html") if File.exists?("yard_hack/index.html")
|
62
|
+
FileUtils.cd(old_dir)
|
60
63
|
VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} #{fn}/doc/index.html")
|
61
64
|
@main.file_tree.refresh()
|
62
65
|
end
|
@@ -114,8 +117,7 @@ class VR_File_Tree < VR::FileTreeView
|
|
114
117
|
end
|
115
118
|
end
|
116
119
|
|
117
|
-
def self__key_press_event(view, evt)
|
118
|
-
alert evt.keyval.to_s
|
120
|
+
def self__key_press_event(view, evt)
|
119
121
|
return unless evt.keyval == 65535 #delete
|
120
122
|
return unless file_name = get_selected_path()
|
121
123
|
return unless alert("Delete: <b>" + File.basename(file_name) + "</b> ?" , :button_yes => "Delete", :button_no=>"Cancel", :parent=>self, :headline => "Delete FIle?")
|
data/vrlib/lib/Alert.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
|
2
2
|
module VR
|
3
3
|
|
4
|
-
|
4
|
+
# @see #alert
|
5
|
+
class Alert
|
5
6
|
|
6
7
|
attr_accessor :answer
|
7
8
|
|
@@ -56,53 +57,40 @@ module VR
|
|
56
57
|
|
57
58
|
end
|
58
59
|
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
72
|
-
#
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
|
91
|
-
# :title = title of the window (appears in bar at top) Default = :headline
|
92
|
-
# :headline = large text that appears at the top.
|
93
|
-
# :parent = reference to parent window. Alert box will always be on top of this parent. Usually=self!
|
94
|
-
#
|
95
|
-
# ALL THESE FLAGS ARE OPTIONAL
|
96
|
-
#
|
97
|
-
# If you want to add these buttons, just set their values to whatever text you want them to
|
98
|
-
# display. For example, :button_no => "Abort Process" will cause the second button, to display
|
99
|
-
# "Abort Process" and if the user clicks it, the alert method will return false.
|
100
|
-
#
|
101
|
-
# There are many examples in the "alert_box" example project.
|
102
|
-
#
|
103
|
-
def alert(msg, flags = {})
|
60
|
+
# The alert method creates a pop-up alert in your program. It creates a modal
|
61
|
+
# window that halts execution of your code until the user closes it. Its great
|
62
|
+
# for displaying messages and debugging. It also has the option of displaying
|
63
|
+
# a text entry box for getting text input from the user. This small tool can save
|
64
|
+
# hundreds of lines of code in your programs. It can be used extesnively to
|
65
|
+
# display all types of messages and request all types of user input.
|
66
|
+
#
|
67
|
+
# @example
|
68
|
+
# alert("Continue?", button_no: "Nope", button_cancel: "Quit", parent: self)
|
69
|
+
#
|
70
|
+
# The alert box can disply 1, 2 or 3 buttons. The first button is denoted using the symbol: :button_yes
|
71
|
+
# button and is always displayed. You can add :button_no and :button_cancel.
|
72
|
+
# If you want to add these buttons, just set their values to whatever text you want them to
|
73
|
+
# display and they will appear. Likewise, if you add the option, :input_text, a text entry box will
|
74
|
+
# appear.
|
75
|
+
#
|
76
|
+
# There are many examples in the "alert_box" example project.
|
77
|
+
# @param [String] message text message to display in alert box. Uses markup.
|
78
|
+
# @param [Hash] options -- Hash of options: :button_yes => text on the button that returns true.
|
79
|
+
# @option options [String] :button_yes Text that appears on the "yes" button.
|
80
|
+
# @option options [String] :button_no Text taht appears on "no" button. (set to make no button appear)
|
81
|
+
# @option options [String] :button_cancel Text taht appears on "cancel" button. (set to make cancel button appear)
|
82
|
+
# @option options [String] :input_text Text that appears in entry box. (set to make entry box appear)
|
83
|
+
# @option options [String] :headline Larger headline over text message.
|
84
|
+
# @option options [String] :title Title of the alert box window. Defaults to :headline.
|
85
|
+
# @option options [Integer] :width The width in pixels of the window for wrapping text.
|
86
|
+
# @option options [Object #builder] :parent The window that the alert box is always on top of.
|
87
|
+
# @return [String] text in the text entry field when the :button_yes button is pressed
|
88
|
+
# @return [true] When the :button_yes button is selected and there's no text entry box.
|
89
|
+
# @return [false] When :button_no is pressed
|
90
|
+
# @return [nil] When :button_cancel os the "X" button is pressed.
|
91
|
+
def alert(message, options = {})
|
104
92
|
@answer = VR::DialogAnswer.new()
|
105
|
-
VR::Alert.new(
|
93
|
+
VR::Alert.new(message, @answer, options).show_glade(options[:parent])
|
106
94
|
return @answer.answer
|
107
95
|
end
|
108
96
|
|
data/vrlib/lib/GladeGUI.rb
CHANGED
@@ -1,24 +1,22 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# GladeGUI works by adding an instance variable, @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
|
1
|
+
# =GladeGUI
|
2
|
+
#
|
3
|
+
# GladeGUI connects your class to a glade form.
|
4
|
+
# It will load a .glade
|
5
|
+
# file into memory, enabling your ruby programs to have a GUI interface.
|
11
6
|
#
|
12
|
-
#
|
13
|
-
#
|
7
|
+
# GladeGUI works by adding an instance variable, @builder to your class. The @builder
|
8
|
+
# variable is an instance of {Gtk::Builder}[http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3ABuilder]
|
9
|
+
# It holds references to all your windows and widgets.
|
14
10
|
#
|
15
|
-
#
|
11
|
+
# =Include the GladeGUI interface
|
16
12
|
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
13
|
+
# To use the GladeGUI interface, include this line after your
|
14
|
+
# “class” declaration:
|
15
|
+
# @example
|
16
|
+
# class MyClass
|
17
|
+
# include GladeGUI
|
18
|
+
# ...
|
19
|
+
# End
|
22
20
|
#
|
23
21
|
# GladeGUI will load a corresponding
|
24
22
|
# glade file for this class. It knows which glade file to load by using a naming
|
@@ -86,10 +84,9 @@
|
|
86
84
|
# the “email” widget in glade using the @email variable. so
|
87
85
|
# you don’t need to include the above line of code. (see
|
88
86
|
# set_glade_variables() method.)
|
89
|
-
|
90
|
-
|
91
87
|
module GladeGUI
|
92
|
-
|
88
|
+
|
89
|
+
# @attribute A Builder object that holds references to everyhting from the galde form.
|
93
90
|
attr_accessor :builder
|
94
91
|
|
95
92
|
##
|
@@ -118,25 +115,23 @@ end
|
|
118
115
|
|
119
116
|
|
120
117
|
##
|
121
|
-
#
|
122
|
-
#
|
123
|
-
#
|
124
|
-
#
|
125
|
-
#
|
126
|
-
#
|
127
|
-
# widget = @builder["name"]
|
128
|
-
#
|
129
|
-
# Normally, you should give your widgets names of instance variables: i.e. @email
|
130
|
-
# so they can be autoloaded using the set_glade_all() method. For example,
|
131
|
-
# the value of the @email vaiable would be loaded into a Gtk:Entry named "email"
|
132
|
-
# in your glade form. It saves you from having to do this:
|
118
|
+
# This will Load the glade form according to the naming convention: MyClass.rb => MyClass.glade.
|
119
|
+
# It will create a Gtk::Builder object from your glade file.
|
120
|
+
# The Gtk::Builder object is stored in the instance variable, @builder.
|
121
|
+
# You can get a reference to any of the widgets on the glade form by
|
122
|
+
# using the @builder object:
|
133
123
|
#
|
134
|
-
#
|
124
|
+
# @example
|
125
|
+
# widget = @builder["name"]
|
135
126
|
#
|
136
|
-
#
|
137
|
-
#
|
138
|
-
#
|
139
|
-
|
127
|
+
# Normally, you should give your widgets names of instance variables: i.e. @email
|
128
|
+
# so they can be autoloaded when the glade form is shown using the #show_glade method. For example,
|
129
|
+
# the value of the @email vaiable would be loaded into a Gtk:Entry named "email"
|
130
|
+
# in your glade form. It saves you from having to do this:
|
131
|
+
#
|
132
|
+
# @example
|
133
|
+
# @builder[:email].text = @email
|
134
|
+
#
|
140
135
|
def load_glade()
|
141
136
|
caller__FILE__ = my_class_file_path()
|
142
137
|
file_name = File.join(File.split(caller__FILE__)[0] , "glade", class_name(self) + ".glade")
|
@@ -145,18 +140,22 @@ end
|
|
145
140
|
@builder.connect_signals{ |handle| method(handle) }
|
146
141
|
end
|
147
142
|
|
148
|
-
def class_name(obj) # :nodoc:
|
143
|
+
private def class_name(obj) # :nodoc:
|
149
144
|
/.*\b(\w+)$/.match(obj.class.name)[1]
|
150
145
|
end
|
151
146
|
|
152
|
-
#
|
147
|
+
# Connects gtk's signals to your methods according to the naming convention widget__signal. For example,
|
153
148
|
# when you place a button called "button1" in your glade form, and declare a method called
|
154
149
|
# "button1__clicked", they aren't connected to each other. Clicking on the button does nothing
|
155
150
|
# and the method never gets called. After running parse_signals(), the "clicked" signal is
|
156
151
|
# connected to the method named "button1__clicked" so when the user clicks the button, the method is called.
|
157
152
|
#
|
158
|
-
#
|
159
|
-
|
153
|
+
# @example methods
|
154
|
+
# button1__clicked(*args)
|
155
|
+
# self__row_activated(*args)
|
156
|
+
# instance_variable__key_press_event(*args)
|
157
|
+
#
|
158
|
+
# Remember that it will enforce the naming convention: name__signal (two underscores).
|
160
159
|
def parse_signals()
|
161
160
|
meths = self.class.instance_methods()
|
162
161
|
meths.each do |meth|
|
@@ -220,25 +219,24 @@ end
|
|
220
219
|
get_glade_variables(obj)
|
221
220
|
end
|
222
221
|
|
223
|
-
#
|
224
|
-
#
|
225
|
-
#
|
226
|
-
#
|
227
|
-
#
|
228
|
-
#
|
229
|
-
#
|
230
|
-
#
|
231
|
-
#
|
232
|
-
#
|
233
|
-
#
|
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.
|
222
|
+
# Populates the glade form from the fields of an ActiveRecord object.
|
223
|
+
# So instead of having to assign each widget a value:
|
224
|
+
# @example
|
225
|
+
# @builder["name"].text = @name
|
226
|
+
# @builder["address"].text = @address
|
227
|
+
# @builder["email"].text = @eamil
|
228
|
+
# @builder["phone"].text = @phone
|
229
|
+
#
|
230
|
+
# You can write one line of code:
|
231
|
+
# @example
|
232
|
+
# set_glade_active_record()
|
238
233
|
#
|
239
|
-
#
|
234
|
+
# The optional parameter is seldom used because you usually want the
|
235
|
+
# glade form to populate from the calling class. If you passed another object,
|
236
|
+
# the form would populate from it.
|
240
237
|
#
|
241
|
-
|
238
|
+
# @param [ActiveRecord::Base] obj Any activerecod base object.
|
239
|
+
# @return none
|
242
240
|
def set_glade_active_record(obj = self)
|
243
241
|
return if not defined? @attributes
|
244
242
|
obj.attributes.each_pair { |key, val| fill_control(class_name(obj) + "." + key, val) }
|
@@ -310,26 +308,26 @@ end
|
|
310
308
|
end
|
311
309
|
|
312
310
|
#
|
313
|
-
#
|
314
|
-
#
|
315
|
-
#
|
316
|
-
#
|
317
|
-
#
|
318
|
-
# @
|
319
|
-
# @
|
320
|
-
# @
|
321
|
-
#
|
322
|
-
# you can write one line of code:
|
311
|
+
# Populates your instance variables from the glade form.
|
312
|
+
# This works for Gtk:Button, Gtk::Entry, Gtk::Label and Gtk::Checkbutton.
|
313
|
+
# So instead of having to assign instance variable:
|
314
|
+
#
|
315
|
+
# @example
|
316
|
+
# @name = @builder["name"].text
|
317
|
+
# @address = @builder["address"].text
|
318
|
+
# @eamil = @builder["email"].text
|
319
|
+
# @phone = @builder["phone"].text
|
323
320
|
#
|
324
|
-
#
|
321
|
+
# You can write one line of code:
|
322
|
+
#
|
323
|
+
# @example
|
324
|
+
# get_glade_variables()
|
325
325
|
#
|
326
|
-
#
|
327
|
-
#
|
328
|
-
#
|
329
|
-
#
|
330
|
-
#
|
331
|
-
#
|
332
|
-
|
326
|
+
# The optional parameter is seldom used because you usually want the
|
327
|
+
# glade form to populate from the calling class. If you passed another object,
|
328
|
+
# the form would populate from it.
|
329
|
+
# @param [Object] obj Any object with instance variables with same names as in galde form.
|
330
|
+
# @return none
|
333
331
|
def get_glade_variables(obj = self)
|
334
332
|
obj.instance_variables.each do |v|
|
335
333
|
v = v.to_s #fix for ruby 1.9 giving symbols
|
@@ -372,7 +370,7 @@ end
|
|
372
370
|
end
|
373
371
|
|
374
372
|
|
375
|
-
|
373
|
+
# Ignore, just helps figure out name of class including GladeGUI
|
376
374
|
def self.included(obj)
|
377
375
|
temp = caller[0].split(":") #correct for windows C:\Users\george etc.
|
378
376
|
caller_path_to_class_file, = temp[0].size == 1 ? temp[0] + ":" + temp[1] : temp[0]
|
@@ -384,12 +382,12 @@ end
|
|
384
382
|
end
|
385
383
|
|
386
384
|
|
387
|
-
|
388
|
-
#
|
389
|
-
#
|
390
|
-
#
|
391
|
-
#
|
392
|
-
#
|
385
|
+
|
386
|
+
# The method you call to show the glade form.
|
387
|
+
# It loads the glade form, sets all the form's widgets to your instance variables,
|
388
|
+
# connects all your methods to their signals, and starts Gtk.main loop if necessary.
|
389
|
+
# @param [Object #builder] parent Optional parent that this window will always be on top of.
|
390
|
+
# @return nothing.
|
393
391
|
def show_glade(parent = nil)
|
394
392
|
load_glade()
|
395
393
|
if parent then
|
@@ -402,25 +400,29 @@ end
|
|
402
400
|
@top_level_window = Gtk.main_level == 0 ? true : false
|
403
401
|
Gtk.main if @top_level_window or @builder[:window1].modal? #need new Gtk.main for blocking!
|
404
402
|
end
|
405
|
-
|
403
|
+
|
404
|
+
# Called when window is destroyed when you execute: <tt>@builder[:window1].destroy</tt>
|
405
|
+
# It manages the Gtk.main loop for all the windows.
|
406
406
|
def window1__destroy(*args)
|
407
407
|
Gtk.main_quit if @top_level_window or @builder["window1"].modal?
|
408
408
|
end
|
409
409
|
|
410
|
+
# Convenience method so you can just make a button named "buttonCancel" and it will work. This
|
411
|
+
# method isn't called in code, its triggered by a user clicking a button named "buttonCancel".
|
410
412
|
def buttonCancel__clicked(*a)
|
411
413
|
@builder[:window1].destroy
|
412
414
|
end
|
413
415
|
|
414
|
-
|
415
|
-
def active_record_valid?(show_errors = true)
|
416
|
-
get_glade_all
|
417
|
-
if not self.valid?
|
418
|
-
alset(self.errors.full_messages.join("\n\n")) if show_errors
|
419
|
-
self.reload
|
420
|
-
return false
|
421
|
-
end
|
422
|
-
return true
|
423
|
-
end
|
416
|
+
#
|
417
|
+
# private def active_record_valid?(show_errors = true)
|
418
|
+
# get_glade_all
|
419
|
+
# if not self.valid?
|
420
|
+
# alset(self.errors.full_messages.join("\n\n")) if show_errors
|
421
|
+
# self.reload
|
422
|
+
# return false
|
423
|
+
# end
|
424
|
+
# return true
|
425
|
+
# end
|
424
426
|
|
425
427
|
|
426
428
|
end
|
@@ -1,14 +1,24 @@
|
|
1
1
|
|
2
2
|
module VR
|
3
3
|
|
4
|
-
class FileTreeView < VR::TreeView
|
4
|
+
class FileTreeView < VR::TreeView
|
5
5
|
|
6
6
|
include GladeGUI
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
|
9
|
+
|
10
|
+
# A code block that further eliminates files included in the tree. If this block returns false
|
11
|
+
# for the entry, it will be excluded.
|
12
|
+
|
13
|
+
attr_accessor :validation_block, :root, :glob
|
14
|
+
|
15
|
+
# FileTreeView creates a TreeView of files with folders and icons.
|
16
|
+
# Often you should subclass this class for a particular use.
|
17
|
+
# @param [String] root Root folder of the tree
|
18
|
+
# @param [String] icon_path Path to a folder where icons are stored. See VR::IconHash
|
19
|
+
# @param [String] glob Glob designating the files to be included. Google: "ruby glob" for more.
|
10
20
|
def initialize(root = Dir.pwd, icon_path = nil, glob = "*")
|
11
|
-
@root = root
|
21
|
+
@root = File.expand_path(root)
|
12
22
|
@glob = glob
|
13
23
|
super(:file => {:pix => Gdk::Pixbuf, :file_name => String}, :empty => TrueClass, :path => String, :modified_date => VR::DateCol, :sort_on => String)
|
14
24
|
col_visible( :path => false, :modified_date => false, :sort_on => false, :empty => false)
|
@@ -21,7 +31,11 @@ module VR
|
|
21
31
|
self.visible = true # necessary!
|
22
32
|
end
|
23
33
|
|
24
|
-
#
|
34
|
+
# Refreshes the file tree, optionally with a new root folder, and optionally opening an array of folders.
|
35
|
+
# @param [Hash] flags Optionally pass a root or array of folders to open.
|
36
|
+
# @option flags [String] :root Path to root folder to open
|
37
|
+
# @option flags [Array] :open_folders A list of folders to open, possibly from #get_open_folders.
|
38
|
+
# Default: the currently open folders, so the tree doesn't collapse when refreshed.
|
25
39
|
def refresh(flags={})
|
26
40
|
@root = flags[:root] if flags[:root]
|
27
41
|
open_folders = flags[:open_folders] ? flags[:open_folders] : get_open_folders()
|
@@ -31,9 +45,10 @@ module VR
|
|
31
45
|
# fill_folder(@root_iter)
|
32
46
|
# expand_row(@root_iter.path, false)
|
33
47
|
open_folders(open_folders)
|
34
|
-
end
|
35
|
-
|
36
|
-
|
48
|
+
end
|
49
|
+
|
50
|
+
# reads a folder from the disk and expands it.
|
51
|
+
private def fill_folder(parent_iter)
|
37
52
|
model.remove(parent_iter.first_child) #remove dummy record
|
38
53
|
files = Dir.glob(File.join(parent_iter[id(:path)],@glob))
|
39
54
|
files = files.select &@validation_block if @validation_block
|
@@ -48,6 +63,7 @@ module VR
|
|
48
63
|
expand_row(iter.path, false)
|
49
64
|
end
|
50
65
|
|
66
|
+
# Expands or collapses the currently selected row
|
51
67
|
def expand_or_collapse_folder()
|
52
68
|
return unless row = selected_rows.first
|
53
69
|
if row_expanded?(row.path)
|
@@ -55,22 +71,25 @@ module VR
|
|
55
71
|
else
|
56
72
|
self__row_expanded(self, row, row.path)
|
57
73
|
end
|
58
|
-
end
|
59
|
-
|
74
|
+
end
|
75
|
+
|
76
|
+
# returns an array of open folders.
|
60
77
|
def get_open_folders()
|
61
78
|
expanded = []
|
62
79
|
map_expanded_rows {|view, path| expanded << model.get_iter(path)[id(:path)] }
|
63
80
|
return expanded
|
64
|
-
end
|
65
|
-
|
81
|
+
end
|
82
|
+
|
83
|
+
# Opens a list of folders.
|
66
84
|
def open_folders(folder_paths)
|
67
85
|
model.each do |model, path, iter|
|
68
86
|
if folder_paths.include?(iter[id(:path)])
|
69
87
|
self__row_expanded(self, iter, path)
|
70
88
|
end
|
71
89
|
end
|
72
|
-
end
|
73
|
-
|
90
|
+
end
|
91
|
+
|
92
|
+
# Adds a file to the tree under a given parent iter.
|
74
93
|
def add_file(filename, parent = @root_iter)
|
75
94
|
my_path = File.dirname(filename)
|
76
95
|
model.each do |model, path, iter|
|
@@ -92,17 +111,18 @@ module VR
|
|
92
111
|
end
|
93
112
|
return child
|
94
113
|
end
|
95
|
-
|
96
|
-
|
114
|
+
|
115
|
+
# Sets whether or not the little arrow expanders appear net to the folders.
|
116
|
+
# @param [Boolean] expand Whether or not to show the expanders next to the folders.
|
117
|
+
def set_show_expanders(expand = true)
|
97
118
|
self.show_expanders = expand
|
98
119
|
self.level_indentation = expand ? 0 : 12
|
99
|
-
end
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
def get_selected_path() (selection.selected ? selection.selected[id(:path)] : nil) end
|
120
|
+
end
|
121
|
+
|
122
|
+
# Returns the full filename with path of the selected file
|
123
|
+
def get_selected_path()
|
124
|
+
selection.selected ? selection.selected[id(:path)] : nil
|
125
|
+
end
|
106
126
|
|
107
127
|
end
|
108
128
|
|
@@ -5,30 +5,30 @@ module VR
|
|
5
5
|
|
6
6
|
include ViewCommon
|
7
7
|
|
8
|
-
#The new() constructor takes a Hash that defines the columns as its only argument. The Hash defines
|
9
|
-
#symbols as the keys to give an ID to each column. The Hash also defines the type (class) of the column.
|
10
|
-
#A simple constructor looks like this:
|
8
|
+
# The new() constructor takes a Hash that defines the columns as its only argument. The Hash defines
|
9
|
+
# symbols as the keys to give an ID to each column. The Hash also defines the type (class) of the column.
|
10
|
+
# A simple constructor looks like this:
|
11
|
+
# @example
|
12
|
+
# @view = VR::ListView.new(:name => String, :date => DateTime)
|
11
13
|
#
|
12
|
-
#
|
14
|
+
# You can create columns with any type of data including your own classes, and classes subclassed
|
15
|
+
# from ActiveRecordBase. The common types that are included by default are:
|
13
16
|
#
|
14
|
-
#
|
15
|
-
#
|
17
|
+
# * String - Displays and edits as a String.
|
18
|
+
# * Integer - Displays number, edits like a String.
|
19
|
+
# * FixNum - ditto
|
20
|
+
# * Integer - ditto
|
21
|
+
# * Float - ditto
|
22
|
+
# * DateTime - Displays in a default date format(editable), edits like a String
|
23
|
+
# * TrueClass - Displays as a GtkCheckButton, click checkbox to edit
|
24
|
+
# * GdkPixbuf - Just an Image, uneditable
|
25
|
+
# * VR::CalendarCol - Displays in a default date format(editable), calendar window to edit.
|
26
|
+
# * VR::SpinCol - Displays as a number with default number of digits, edits like a GtkSpinButton
|
27
|
+
# * VR::ComboCol - Displays String, edits like a GtkComboBoxEntry
|
28
|
+
# * VR::ProgressCol - Displays a GtkProgressBar, uneditable
|
29
|
+
# * VR::TextCol - For long strings. Displays first 20 characters in view, edits with simple text editor.
|
16
30
|
#
|
17
|
-
|
18
|
-
#- Integer - Displays number, edits like a String.
|
19
|
-
#- FixNum - ditto
|
20
|
-
#- Integer - ditto
|
21
|
-
#- Float - ditto
|
22
|
-
#- DateTime - Displays in a default date format(editable), edits like a String
|
23
|
-
#- TrueClass - Displays as a GtkCheckButton, click checkbox to edit
|
24
|
-
#- GdkPixbuf - Just an Image, uneditable
|
25
|
-
#- VR::CalendarCol - Displays in a default date format(editable), calendar window to edit.
|
26
|
-
#- VR::SpinCol - Displays as a number with default number of digits, edits like a GtkSpinButton
|
27
|
-
#- VR::ComboCol - Displays String, edits like a GtkComboBoxEntry
|
28
|
-
#- VR::ProgressCol - Displays a GtkProgressBar, uneditable
|
29
|
-
#- VR::TextCol - For long strings. Displays first 20 characters in view, edits with simple text editor.
|
30
|
-
#
|
31
|
-
#You can also add your own user-defined column types. See: {Adding Your Own Objects to ListView}[link:/site/ListView%20Tutorial.html#objects].
|
31
|
+
# You can also add your own user-defined column types. See: {Adding Your Own Objects to ListView}[link:/site/ListView%20Tutorial.html#objects].
|
32
32
|
#
|
33
33
|
|
34
34
|
def initialize(cls)
|
data/vrlib/rdoc_replace.yaml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
|
-
- - <
|
3
|
-
- <
|
2
|
+
- - "<title>File List</title>"
|
3
|
+
- "<a href=file.README.html><img src=http://visualruby.net/img/splash_small.png></a><p><p>"
|
4
4
|
- - Video:uploading_gems.avi
|
5
5
|
- <iframe width="640" height="480" src="http://www.youtube.com/embed/6VsXlCjU89c"
|
6
6
|
frameborder="0" allowfullscreen></iframe>
|
@@ -47,22 +47,10 @@
|
|
47
47
|
- "<a href=http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3AProgressBar>Gtk::ProgressBar</a>"
|
48
48
|
- - GtkSelection
|
49
49
|
- "<A href=http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3ASelection>Gtk::Selection</a>"
|
50
|
-
- - <
|
51
|
-
-
|
52
|
-
- - "
|
50
|
+
- - <li class="r1"><span class="object_link"><a href="index.html" title="README">README</a></a></li>
|
51
|
+
- "<!-- README deleted makes problem. -->"
|
52
|
+
- - '<div id="search">Search: <input type="text" /></div>'
|
53
53
|
- "<title>Visual Ruby -- GUI with Ruby and Glade</title>"
|
54
|
-
- - "<title>Download - RDoc Documentation</title>"
|
55
|
-
- "<title>Download Visual Ruby -- Make GUIs with Ruby!</title>"
|
56
|
-
- - "<title>RubyGems Tutorial - RDoc Documentation</title>"
|
57
|
-
- "<title>RubyGems Tutorial - Use Visual Ruby to Push Gems!</title>"
|
58
|
-
- - "<title>Signals Tutorial - RDoc Documentation</title>"
|
59
|
-
- "<title>Ruby Signals Tutorial -- signal_connect with Visual Ruby!</title>"
|
60
|
-
- - "<title>ListView Tutorial - RDoc Documentation</title>"
|
61
|
-
- "<title>Ruby ListView Tutorial</title>"
|
62
|
-
- - "<title>Child Windows Tutorial - RDoc Documentation</title>"
|
63
|
-
- "<title>Ruby Child Windows Tutorial</title>"
|
64
|
-
- - "<title>Help--Contact Info - RDoc Documentation</title>"
|
65
|
-
- "<title>Visual Ruby Help</title>"
|
66
54
|
- - video:activerecord.avi
|
67
55
|
- <iframe width="640" height="480" src="http://www.youtube.com/embed/uySVKltD7fk"
|
68
56
|
frameborder="0" allowfullscreen></iframe>
|
@@ -73,5 +61,5 @@
|
|
73
61
|
- - video:activerecord2.avi
|
74
62
|
- <iframe width="640" height="480" src="http://www.youtube.com/embed/3f1Lj5Q2Q8g"
|
75
63
|
frameborder="0" allowfullscreen></iframe>
|
76
|
-
- - <
|
77
|
-
- "
|
64
|
+
- - <h1 id="full_list_header">File List</h1>
|
65
|
+
- "<!- deleted -->"
|
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.11
|
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-06-
|
12
|
+
date: 2016-06-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gtk3
|
@@ -111,7 +111,6 @@ files:
|
|
111
111
|
- "./examples/active_record2/bin/glade/Paycheck.glade"
|
112
112
|
- "./examples/active_record2/db/development.sqlite3"
|
113
113
|
- "./examples/active_record2/main.rb"
|
114
|
-
- "./examples/alert_box/.vr_settings.yaml"
|
115
114
|
- "./examples/alert_box/bin/AlertBoxDemo.rb"
|
116
115
|
- "./examples/alert_box/bin/glade/AlertBoxDemo.glade"
|
117
116
|
- "./examples/alert_box/main.rb"
|
@@ -170,7 +169,6 @@ files:
|
|
170
169
|
- "./examples/listview_objects/bin/glade/DataObject.glade"
|
171
170
|
- "./examples/listview_objects/bin/glade/ListViewObjectsGUI.glade"
|
172
171
|
- "./examples/listview_objects/main.rb"
|
173
|
-
- "./examples/settings_file/.vr_settings.yaml"
|
174
172
|
- "./examples/settings_file/bin/MainApp.rb"
|
175
173
|
- "./examples/settings_file/bin/SavableSettings.rb"
|
176
174
|
- "./examples/settings_file/bin/glade/MainApp.glade"
|
@@ -202,7 +200,6 @@ files:
|
|
202
200
|
- "./skeleton/project/bin/glade/MyClass.glade"
|
203
201
|
- "./skeleton/project/main.rb"
|
204
202
|
- "./vr"
|
205
|
-
- "./vrlib/.vr_settings.yaml"
|
206
203
|
- "./vrlib/lib/Alert.rb"
|
207
204
|
- "./vrlib/lib/DragDrop.rb"
|
208
205
|
- "./vrlib/lib/GladeGUI.rb"
|
@@ -1,17 +0,0 @@
|
|
1
|
-
--- !ruby/object:VR_ENV
|
2
|
-
width: 1329
|
3
|
-
height: 753
|
4
|
-
panel_pos: 513
|
5
|
-
run_command_line: ruby main.rb
|
6
|
-
open_files:
|
7
|
-
- "/home/eric/vrp/vr3/examples/alert_box/bin/AlertBoxDemo.rb"
|
8
|
-
- "/home/eric/vrp/vr3/examples/alert_box/main.rb"
|
9
|
-
open_folders:
|
10
|
-
- "/home/eric/vrp/vr3/examples/alert_box"
|
11
|
-
- "/home/eric/vrp/vr3/examples/alert_box/bin"
|
12
|
-
current_file: "/home/eric/vrp/vr3/examples/alert_box/bin/AlertBoxDemo.rb"
|
13
|
-
rdoc_command_line: rdoc -x README
|
14
|
-
vr_yaml_file: ".vr_settings.yaml"
|
15
|
-
notebook_panel_position: 400
|
16
|
-
current_line: 61
|
17
|
-
settings_file_version: 1
|
@@ -1,24 +0,0 @@
|
|
1
|
-
--- !ruby/object:VR_ENV
|
2
|
-
width: 1264
|
3
|
-
height: 727
|
4
|
-
panel_pos: 267
|
5
|
-
run_command_line: ruby main.rb
|
6
|
-
open_files:
|
7
|
-
- "/home/eric/vrp/vr3/examples/settings_file/main.rb"
|
8
|
-
- "/home/eric/vrp/vr3/examples/settings_file/bin/SavableSettings.rb"
|
9
|
-
- "/home/eric/vrp/vr3/examples/settings_file/bin/MainApp.rb"
|
10
|
-
open_folders:
|
11
|
-
- "/home/eric/vrp/vr3/examples/settings_file"
|
12
|
-
- "/home/eric/vrp/vr3/examples/settings_file/bin"
|
13
|
-
- "/home/eric/vrp/vr3/examples/settings_file/bin/glade"
|
14
|
-
current_file: "/home/eric/vrp/vr3/examples/settings_file/bin/SavableSettings.rb"
|
15
|
-
rdoc_command_line: rdoc -x README
|
16
|
-
vr_yaml_file: ".vr_settings.yaml"
|
17
|
-
notebook_panel_position: 444
|
18
|
-
current_line: 24
|
19
|
-
filename: ".vr_settings.yaml"
|
20
|
-
backup_path: "/home/eric"
|
21
|
-
browser: firefox
|
22
|
-
font_name: Monospace 10
|
23
|
-
glade_path: glade-3
|
24
|
-
tab_spaces: 2
|
data/vrlib/.vr_settings.yaml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
--- !ruby/object:VR_ENV
|
2
|
-
vr_yaml_file: ".vr_settings.yaml"
|
3
|
-
width: 1364
|
4
|
-
height: 691
|
5
|
-
panel_pos: 264
|
6
|
-
notebook_panel_position: 400
|
7
|
-
run_command_line: ruby main.rb
|
8
|
-
open_files:
|
9
|
-
- "/home/eric/vrp/vr3/vrlib/Untitled"
|
10
|
-
open_folders:
|
11
|
-
- "/home/eric/vrp/vr3/vrlib"
|
12
|
-
- "/home/eric/vrp/vr3/vrlib/lib"
|
13
|
-
- "/home/eric/vrp/vr3/vrlib/lib/treeview"
|
14
|
-
- "/home/eric/vrp/vr3/vrlib/site"
|
15
|
-
current_file: "/home/eric/vrp/vr3/vrlib/Untitled"
|
16
|
-
current_line: 1
|
17
|
-
rdoc_command_line: rdoc -x /*.glade -x /*.css -x /*.gemspec -x /*.yaml
|
18
|
-
builder: !ruby/object:Gtk::Builder {}
|
19
|
-
top_level_window: false
|
20
|
-
settings_file_version: 1
|
21
|
-
filename: ".vr_settings.yaml"
|