visualruby 3.0.2 → 3.0.3
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 +27 -0
- data/bin/editor/VR_Document.rb +156 -156
- data/bin/editor/VR_TabSearch.rb +37 -37
- data/bin/editor/VR_Tabs.rb +82 -82
- data/bin/editor/VR_TextShell.rb +49 -52
- data/bin/editor/VR_TextViewCommon.rb +31 -31
- data/bin/main/GemTree.rb +14 -14
- data/bin/main/NewProjectGUI.rb +24 -24
- data/bin/main/OpenProject.rb +53 -53
- data/bin/main/ProjectChooserView.rb +31 -31
- data/bin/main/ProjectTree.rb +17 -17
- data/bin/main/RubygemsAPI.rb +73 -63
- data/bin/main/VR_ENV.rb +29 -29
- data/bin/main/VR_ENV_GLOBAL.rb +52 -52
- data/bin/main/VR_File_Tree.rb +88 -88
- data/bin/main/VR_Local_Gem_Tree.rb +53 -53
- data/bin/main/VR_Main.rb +240 -238
- data/bin/main/VR_Remote_Gem_Tree.rb +41 -41
- data/bin/main/glade/Splash.glade +19 -0
- data/bin/tools/VR_Tools.rb +72 -72
- data/examples/active_record/.vr_settings.yaml +50 -0
- data/examples/active_record/active_record.rb +2 -2
- data/examples/active_record/bin/ChoosePerson.rb +10 -10
- data/examples/active_record/bin/Person.rb +6 -6
- data/examples/active_record2/.vr_settings.yaml +23 -0
- data/examples/active_record2/bin/CompanyGUI.rb +42 -42
- data/examples/active_record2/bin/Employee.rb +13 -13
- data/examples/active_record2/bin/Employer.rb +5 -5
- data/examples/active_record2/bin/Paycheck.rb +5 -5
- data/examples/active_record2/main.rb +4 -4
- data/examples/alert_box/bin/AlertBoxDemo.rb +40 -50
- data/examples/alert_box/bin/glade/AlertBoxDemo.glade +14 -45
- data/examples/all_widgets/.vr_settings.yaml +18 -0
- data/examples/all_widgets/bin/AllWidgets.rb +19 -16
- data/examples/calculator/.vr_settings.yaml +18 -0
- data/examples/calculator/bin/Calculator.rb +22 -22
- data/examples/child_window/.vr_settings.yaml +21 -0
- data/examples/child_window/bin/ChildWindowDemo.rb +10 -10
- data/examples/child_window/bin/ModalWindow.rb +4 -4
- data/examples/child_window/bin/ModelessWindow.rb +4 -4
- data/examples/child_window/bin/MyChildClass.rb +10 -10
- data/examples/drag_drop/.vr_settings.yaml +16 -0
- data/examples/drag_drop/bin/DragDropDemo.rb +28 -28
- data/examples/filetreeview/.vr_settings.yaml +20 -0
- data/examples/filetreeview/bin/ProjectTree.rb +13 -23
- data/examples/filetreeview/bin/ProjectTreeGUI.rb +18 -17
- data/examples/listview/.vr_settings.yaml +19 -0
- data/examples/listview/bin/SongListView.rb +72 -72
- data/examples/listview/bin/SongListViewGUI.rb +52 -52
- data/examples/listview_objects/.vr_settings.yaml +19 -0
- data/examples/listview_objects/bin/DataObject.rb +23 -23
- data/examples/listview_objects/bin/ListViewObjects.rb +29 -29
- data/examples/listview_objects/bin/ListViewObjectsGUI.rb +12 -12
- data/examples/settings_file/bin/MainApp.rb +25 -25
- data/examples/settings_file/bin/SavableSettings.rb +25 -26
- data/examples/settings_file/settings.yaml +1 -1
- data/examples/simple_ruby_gui/.vr_settings.yaml +20 -0
- data/examples/simple_ruby_gui/bin/DataObjectGUI.rb +12 -12
- data/examples/treeview/.vr_settings.yaml +17 -0
- data/examples/treeview/bin/MyClass.rb +18 -17
- data/examples/treeview/bin/glade/MyClass.glade +61 -6
- data/skeleton/document/NewWindow.rb +8 -8
- data/skeleton/project/.vr_settings.yaml +15 -0
- data/skeleton/project/bin/MyClass.rb +7 -7
- data/vr +38 -41
- data/vrlib/doc/images/add.png +0 -0
- data/vrlib/doc/images/arrow_up.png +0 -0
- data/vrlib/doc/images/brick.png +0 -0
- data/vrlib/doc/images/brick_link.png +0 -0
- data/vrlib/doc/images/bug.png +0 -0
- data/vrlib/doc/images/bullet_black.png +0 -0
- data/vrlib/doc/images/bullet_toggle_minus.png +0 -0
- data/vrlib/doc/images/bullet_toggle_plus.png +0 -0
- data/vrlib/doc/images/date.png +0 -0
- data/vrlib/doc/images/delete.png +0 -0
- data/vrlib/doc/images/find.png +0 -0
- data/vrlib/doc/images/macFFBgHack.png +0 -0
- data/vrlib/doc/images/package.png +0 -0
- data/vrlib/doc/images/page_green.png +0 -0
- data/vrlib/doc/images/page_white_text.png +0 -0
- data/vrlib/doc/images/page_white_width.png +0 -0
- data/vrlib/doc/images/plugin.png +0 -0
- data/vrlib/doc/images/ruby.png +0 -0
- data/vrlib/doc/images/tag_blue.png +0 -0
- data/vrlib/doc/images/tag_green.png +0 -0
- data/vrlib/doc/images/transparent.png +0 -0
- data/vrlib/doc/images/wrench.png +0 -0
- data/vrlib/doc/images/wrench_orange.png +0 -0
- data/vrlib/doc/images/zoom.png +0 -0
- data/vrlib/lib/Alert.rb +98 -55
- data/vrlib/lib/DragDrop.rb +43 -43
- data/vrlib/lib/GladeGUI.rb +207 -207
- data/vrlib/lib/IconHash.rb +10 -10
- data/vrlib/lib/SavableClass.rb +38 -38
- data/vrlib/lib/SimpleComboBoxEntry.rb +3 -3
- data/vrlib/lib/treeview/FileTreeView.rb +71 -70
- data/vrlib/lib/treeview/IterMethods.rb +35 -35
- data/vrlib/lib/treeview/ListView.rb +25 -25
- data/vrlib/lib/treeview/TreeView.rb +15 -15
- data/vrlib/lib/treeview/ViewCommon.rb +134 -131
- data/vrlib/lib/treeview/columns/CalendarCol.rb +48 -48
- data/vrlib/lib/treeview/columns/CellRendererCombo.rb +26 -26
- data/vrlib/lib/treeview/columns/CellRendererDate.rb +25 -25
- data/vrlib/lib/treeview/columns/CellRendererObject.rb +37 -37
- data/vrlib/lib/treeview/columns/CellRendererPhone.rb +25 -25
- data/vrlib/lib/treeview/columns/CellRendererPixbuf.rb +8 -8
- data/vrlib/lib/treeview/columns/CellRendererProgress.rb +8 -8
- data/vrlib/lib/treeview/columns/CellRendererSpin.rb +17 -17
- data/vrlib/lib/treeview/columns/CellRendererText.rb +18 -18
- data/vrlib/lib/treeview/columns/CellRendererToggle.rb +25 -25
- data/vrlib/lib/treeview/columns/ComboCol.rb +12 -12
- data/vrlib/lib/treeview/columns/CurrencyCol.rb +13 -13
- data/vrlib/lib/treeview/columns/DateCol.rb +10 -10
- data/vrlib/lib/treeview/columns/ImageCol.rb +16 -16
- data/vrlib/lib/treeview/columns/SpinCol.rb +5 -5
- data/vrlib/lib/treeview/columns/TextCol.rb +24 -24
- data/vrlib/lib/treeview/columns/TreeViewColumn.rb +71 -76
- data/vrlib/rdoc_replace.yaml +36 -36
- metadata +43 -6
- data/Splash.rb +0 -40
data/bin/editor/VR_Tabs.rb
CHANGED
|
@@ -3,118 +3,118 @@ class VR_Tabs < Gtk::Notebook
|
|
|
3
3
|
|
|
4
4
|
attr_reader :docs
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
include VR_TabSearch
|
|
7
7
|
|
|
8
8
|
def initialize(main)
|
|
9
9
|
super()
|
|
10
10
|
@docs = Array.new
|
|
11
11
|
@main = main
|
|
12
12
|
@pix_close = Gdk::Pixbuf.new(File.dirname(__FILE__) + '/../../img/close.png')
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
@close_filename = File.dirname(__FILE__) + '/../../img/close.png'
|
|
14
|
+
self.scrollable = true #after super
|
|
15
|
+
self.expand = true
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
def update_style_all()
|
|
19
|
+
@docs.each { |doc| doc.update_style() }
|
|
20
|
+
end
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
def try_to_save_all(flags)
|
|
23
|
+
ask = flags[:ask]
|
|
24
|
+
passed = true
|
|
25
|
+
@docs.each do |doc|
|
|
26
|
+
unless doc.try_to_save(ask)
|
|
27
|
+
passed = false
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
(n_pages).times { destroy_tab() } if flags[:close]
|
|
31
|
+
return passed
|
|
32
|
+
end
|
|
33
33
|
|
|
34
34
|
##todo update file_tree!
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
#
|
|
35
|
+
# def try_to_save_all(ask = true)
|
|
36
|
+
# @docs.each do |doc|
|
|
37
|
+
# return false unless doc.try_to_save(ask)
|
|
38
|
+
# end
|
|
39
|
+
# end
|
|
40
40
|
#
|
|
41
41
|
##todo update file_tree!
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
#
|
|
42
|
+
# def try_to_close_all(ask = true)
|
|
43
|
+
# return false unless try_to_save_all(ask)
|
|
44
|
+
# (n_pages).times { destroy_tab() }
|
|
45
|
+
# end
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
def switch_to(path)
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
i = @docs.index{ |d| d.full_path_file == path }
|
|
50
|
+
return false if i.nil?
|
|
51
51
|
self.page = i if i != self.page
|
|
52
|
-
|
|
52
|
+
return true
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
def set_contents(text)
|
|
56
|
+
if @docs[self.page].buffer.text == ""
|
|
57
|
+
@docs[self.page].buffer.text = text
|
|
58
|
+
@docs[self.page].buffer.modified = false
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
def load_tab(full_path_file = Dir.pwd + "/Untitled")
|
|
63
63
|
return if switch_to(full_path_file)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
box = Gtk::EventBox.new
|
|
65
|
+
tab = Gtk::Box.new(:horizontal)
|
|
66
|
+
img = Gtk::Image.new(:pixbuf => @pix_close)
|
|
67
|
+
box.add(img)
|
|
68
|
+
title = Gtk::Label.new(File.basename(full_path_file))
|
|
69
|
+
tab.pack_start(title, :expand=>true, :fill=>true, :padding=>2)
|
|
70
|
+
tab.pack_start(box)
|
|
71
71
|
tab.show_all #needed
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
text = VR_Document.new(full_path_file, title, @main)
|
|
73
|
+
child = Gtk::ScrolledWindow.new
|
|
74
|
+
child.add(text)
|
|
75
|
+
box.signal_connect("button_release_event") {remove_id(text.object_id)}
|
|
76
|
+
#remove blank tab
|
|
77
|
+
if @docs.size == 1 and @docs[0].buffer.text.strip == ""
|
|
78
|
+
@docs[0] = text
|
|
79
|
+
self.remove_page(0)
|
|
80
|
+
end
|
|
81
81
|
child.show_all #needed
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
82
|
+
append_page(child, tab)
|
|
83
|
+
self.page = self.n_pages - 1
|
|
84
|
+
@docs[self.page] = text
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
#used when little 'x' image is clicked to close.
|
|
88
|
+
def remove_id(object_id)
|
|
89
|
+
i = @docs.index { |doc| doc.object_id == object_id }
|
|
90
|
+
if @docs[i].try_to_save(true)
|
|
91
|
+
destroy_tab(i)
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
#if its there, destroys it
|
|
96
|
+
def destroy_file_tab(file_name)
|
|
97
|
+
destroy_tab() if switch_to(file_name)
|
|
98
|
+
end
|
|
99
99
|
|
|
100
100
|
# this spits out a bunch of warnings on remove_page
|
|
101
|
-
|
|
101
|
+
def destroy_tab(tab = self.page)
|
|
102
102
|
self.page = self.page - 1 # stops some warnings
|
|
103
103
|
VR_Tools.clear_events
|
|
104
|
-
#
|
|
105
|
-
|
|
104
|
+
# self.set_tab_label(get_nth_page(tab), nil)
|
|
105
|
+
self.remove_page(tab)
|
|
106
106
|
VR_Tools.clear_events
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
@docs.delete_at(tab)
|
|
108
|
+
load_tab() if @docs.empty?
|
|
109
|
+
end
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
def get_open_fn()
|
|
112
|
+
@docs.inject([]) { |ar, doc| ar << doc.full_path_file }
|
|
113
|
+
end
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
def open_file_names(ar)
|
|
116
|
+
ar.each { |fn| load_tab(fn) if File.file?(fn) and fn.include? Dir.pwd}
|
|
117
117
|
load_tab() if @docs.empty?
|
|
118
|
-
|
|
118
|
+
end
|
|
119
119
|
|
|
120
120
|
end
|
data/bin/editor/VR_TextShell.rb
CHANGED
|
@@ -1,61 +1,58 @@
|
|
|
1
1
|
|
|
2
2
|
class VR_TextShell < GtkSource::View
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
include VR_TextViewCommon
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
def initialize(tabs)
|
|
7
|
+
super()
|
|
8
|
+
@tabs = tabs
|
|
9
|
+
@current_line = 0
|
|
10
|
+
@lines = [] #needed
|
|
11
|
+
self.editable = false
|
|
12
|
+
@blue = buffer.create_tag("blue", { "foreground" => "#0000A0", "underline" => Pango::UNDERLINE_SINGLE })
|
|
13
13
|
self.highlight_current_line = true
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
@hilight = buffer.create_tag("hilight", { "background" => "#FFF0A0" } )
|
|
15
|
+
signal_connect("button_release_event") { jump_to(line_at_cursor() - 1) } #buffer's lines start at 1
|
|
16
|
+
signal_connect("key_release_event") { jump_to(line_at_cursor() - 1) } #buffer's lines start at 1
|
|
17
|
+
end
|
|
18
18
|
|
|
19
|
+
def hilight_links(text, jump_to_first)
|
|
20
|
+
self.buffer.text = text
|
|
21
|
+
first_valid_line = load_lines()
|
|
22
|
+
(0..@lines.size - 1).each do |i|
|
|
23
|
+
next if @lines[i].nil?
|
|
24
|
+
apply_tag_to_line(i, @blue, @lines[i][:file_name] + ":" + @lines[i][:line].to_s)
|
|
25
|
+
end
|
|
26
|
+
@current_line = 0
|
|
27
|
+
@tabs.jump_to(first_valid_line) if jump_to_first and first_valid_line
|
|
28
|
+
end
|
|
19
29
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return first
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def jump_to(line_no = @current_line+1)
|
|
51
|
-
puts "fed: " + line_no.to_s
|
|
52
|
-
return false if line_no > @lines.size
|
|
53
|
-
@current_line = line_no
|
|
54
|
-
# remove_tag(@hilight)
|
|
55
|
-
# apply_tag_to_line(@current_line, @hilight, nil)
|
|
56
|
-
puts "jumping to " + line_no.to_s + " = " + @lines[line_no].to_s
|
|
57
|
-
@tabs.jump_to(@lines[@current_line])
|
|
58
|
-
return false #must return false for button_up event
|
|
59
|
-
end
|
|
30
|
+
def load_lines()
|
|
31
|
+
@lines = []
|
|
32
|
+
first = nil
|
|
33
|
+
reg = /^.*(#{Dir.pwd}[\w+|\/]*)\/([\w|\.]+):(\d+):/
|
|
34
|
+
reg_str = /Found:\s(.+)$/
|
|
35
|
+
self.buffer.text. each_line do |l|
|
|
36
|
+
m = reg.match(l)
|
|
37
|
+
if m.nil?
|
|
38
|
+
@lines << nil
|
|
39
|
+
else
|
|
40
|
+
m2 = reg_str.match(l)
|
|
41
|
+
search_str = (m2.nil?) ? "" : m2[1]
|
|
42
|
+
@lines << { :path => m[1] + "/" + m[2], :file_name => m[2], :line => m[3].to_i, :search_str => search_str }
|
|
43
|
+
first ||= @lines.last
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
return first
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def jump_to(line_no = @current_line+1)
|
|
50
|
+
return false if line_no > @lines.size
|
|
51
|
+
@current_line = line_no
|
|
52
|
+
remove_tag(@hilight)
|
|
53
|
+
apply_tag_to_line(@current_line, @hilight, nil)
|
|
54
|
+
@tabs.jump_to(@lines[@current_line])
|
|
55
|
+
return false #must return false for button_up event
|
|
56
|
+
end
|
|
60
57
|
|
|
61
58
|
end
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
module VR_TextViewCommon
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
def get_line_iters(line, search_str = nil)
|
|
4
|
+
s = buffer.get_iter_at(:line => line)
|
|
5
|
+
e = get_end_iter(s)
|
|
6
|
+
if !search_str.nil?
|
|
7
|
+
s, e = s.forward_search(search_str, :text_only, e)
|
|
8
|
+
end
|
|
9
|
+
return s, e
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def select_text(line, search_str = nil)
|
|
13
|
+
s, e = get_line_iters(line, search_str)
|
|
14
|
+
return if s.nil? or e.nil?
|
|
15
15
|
buffer.place_cursor(s)
|
|
16
|
-
#
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
# buffer.move_mark(buffer.get_mark("insert"),s)
|
|
17
|
+
buffer.move_mark(buffer.get_mark("selection_bound"), e)
|
|
18
|
+
end
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
def apply_tag_to_line(line, tag, search_str = nil)
|
|
22
|
+
s, e = get_line_iters(line, search_str)
|
|
23
|
+
buffer.apply_tag(tag, s, e)
|
|
24
|
+
end
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
def get_end_iter(iter)
|
|
29
29
|
if iter.line == buffer.line_count - 1 # last line
|
|
30
30
|
return buffer.end_iter
|
|
31
31
|
end
|
|
32
32
|
return buffer.get_iter_at(:line => iter.line+1)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def remove_tag(tag)
|
|
36
|
+
s, e = buffer.bounds
|
|
37
|
+
buffer.remove_tag(tag, s, e)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def line_at_cursor()
|
|
41
41
|
cursor_pos = buffer.cursor_position
|
|
42
42
|
iter = buffer.get_iter_at(:offset => cursor_pos) #get_iter_at_offset depricated
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
return iter.line + 1
|
|
44
|
+
end
|
|
45
45
|
|
|
46
46
|
end
|
data/bin/main/GemTree.rb
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
2
|
class GemTree < VR::ListView
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
RUBY_ICON = Gdk::Pixbuf.new(File.dirname(__FILE__) + '/../../img/rb.png')
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
def initialize()
|
|
7
|
+
hash = {:gems => {:pix => Gdk::Pixbuf, :gem => String}}
|
|
8
|
+
super(hash)
|
|
9
|
+
self.headers_visible = false
|
|
10
|
+
@api = RubygemsAPI.new
|
|
11
|
+
end
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
def self__button_release_event(w, event)
|
|
14
|
+
return unless selection.selected and event.button == 3 #right mouse
|
|
15
|
+
@builder['popGem'].popup(nil, nil, event.button, event.time)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
def get_name_ver(line)
|
|
19
|
+
match = /^(.*)\s+\((.*)\)/.match(line)
|
|
20
|
+
return match[1], match[2]
|
|
21
|
+
end
|
|
22
22
|
|
|
23
23
|
end
|
data/bin/main/NewProjectGUI.rb
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
|
|
2
2
|
class NewProjectGUI
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
include GladeGUI
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
attr_accessor :my_var
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
def initialize(parent)
|
|
9
|
+
@parent = parent
|
|
10
|
+
@projects_home = $VR_ENV_GLOBAL.projects_home + "/"
|
|
11
|
+
end
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
def buttonCreate__clicked(*args)
|
|
14
|
+
fn = @builder["entryFolderName"].text
|
|
15
|
+
fn = fn.gsub(/[^\w\.\/]/, '_')
|
|
16
|
+
path = File.join($VR_ENV_GLOBAL.projects_home + "/" + fn)
|
|
17
|
+
if File.directory?(path)
|
|
18
|
+
alert "The folder <b>" + path + "</b> is already ok disk. You can open it using the <b>Open Project</b> button.",
|
|
19
|
+
:headline=> "Project Already Exists", :parent => self, :width => 500
|
|
20
|
+
else
|
|
21
|
+
FileUtils.mkpath path
|
|
22
|
+
VR_Tools.copy_skeleton_project(path)
|
|
23
|
+
@parent.proj_path = path
|
|
24
|
+
@builder["window1"].destroy
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
#
|
|
31
|
-
|
|
28
|
+
def buttonCancel__clicked(*args)
|
|
29
|
+
@my_var = "Hello"
|
|
30
|
+
# @builder["window1"].destroy
|
|
31
|
+
end
|
|
32
32
|
|
|
33
33
|
end
|
data/bin/main/OpenProject.rb
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
1
|
|
|
2
2
|
class OpenProject
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
include GladeGUI
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
def initialize(parent)
|
|
7
|
+
@parent = parent
|
|
8
|
+
@projects_home = $VR_ENV_GLOBAL.projects_home
|
|
9
|
+
end
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
def before_show
|
|
12
|
+
@ftv = ProjectTree.new()
|
|
13
|
+
@ftv.set_show_expanders(false)
|
|
14
|
+
@builder["view"].add(@ftv)
|
|
15
|
+
@ftv.visible = true
|
|
16
|
+
end
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
def ftv__cursor_changed(*a)
|
|
19
|
+
# return unless row = @ftv.selected_rows.first
|
|
20
|
+
@ftv.expand_or_collapse_folder()
|
|
21
|
+
end
|
|
22
22
|
|
|
23
23
|
def ftv__row_activated(_self, path, col)
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
buttonOpen__clicked
|
|
25
|
+
end
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
def buttonChange__clicked(*a)
|
|
28
|
+
$VR_ENV_GLOBAL.show_glade(self)
|
|
29
|
+
@projects_home = $VR_ENV_GLOBAL.projects_home
|
|
30
|
+
@ftv.refresh(:root => @projects_home)
|
|
31
|
+
@builder[:projects_home].label = @projects_home
|
|
32
|
+
end
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
def buttonDelete__clicked(*a)
|
|
35
|
+
return unless row = @ftv.selected_rows.first
|
|
36
|
+
return if row[:path] == Dir.pwd #can't delete current project
|
|
37
|
+
if alert("Do you really want to delete \n<b>" + row[:path] + " </b>?",
|
|
38
|
+
parent: self, headline: "Warning!", button_yes: "Delete", button_no: "Cancel", width: 400)
|
|
39
|
+
FileUtils.remove_dir(row[:path], true)
|
|
40
|
+
@ftv.refresh()
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
#
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
def buttonOpen__clicked(*a)
|
|
45
|
+
return unless row = @ftv.selected_rows.first
|
|
46
|
+
test_file = File.join(row[:path], VR_ENV::SETTINGS_FILE)
|
|
47
|
+
if File.exists?(test_file)
|
|
48
|
+
@parent.proj_path = row[:path]
|
|
49
|
+
buttonCancel__clicked
|
|
50
|
+
else
|
|
51
|
+
# alert("This is not a visualruby project. It's a folder that holds visualruby projects.", :parent=>self, :width=>400)
|
|
52
|
+
@ftv.expand_or_collapse_folder()
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
def buttonNew__clicked(*a)
|
|
57
|
+
old_proj_path = @parent.proj_path
|
|
58
|
+
NewProjectGUI.new(@parent).show_glade(self)
|
|
59
|
+
@builder[:window1].destroy if @parent.proj_path != old_proj_path #new path created!
|
|
60
|
+
end
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
def buttonCancel__clicked(*a) #save state
|
|
64
|
+
$VR_ENV_GLOBAL.projects_home_open_folders = @ftv.get_open_folders()
|
|
65
|
+
VR::save_yaml($VR_ENV_GLOBAL)
|
|
66
|
+
@builder["window1"].destroy
|
|
67
|
+
end
|
|
68
68
|
|
|
69
69
|
end
|