visualruby 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/editor/VR_Document.rb +219 -0
- data/bin/editor/VR_TabSearch.rb +50 -0
- data/bin/editor/VR_Tabs.rb +99 -0
- data/bin/editor/VR_TextShell.rb +83 -0
- data/bin/editor/VR_TextViewCommon.rb +65 -0
- data/bin/editor/glade/VR_Document.glade +160 -0
- data/bin/main/GemTree.rb +23 -0
- data/bin/main/NewProjectGUI.rb +28 -0
- data/bin/main/ProjectChooserGUI.rb +41 -0
- data/bin/main/ProjectChooserView.rb +39 -0
- data/bin/main/RubygemsAPI.rb +93 -0
- data/bin/main/Splash.rb +22 -0
- data/bin/main/VR_ENV.rb +61 -0
- data/bin/main/VR_ENV_GLOBAL.rb +64 -0
- data/bin/main/VR_File_Tree.rb +120 -0
- data/bin/main/VR_Local_Gem_Tree.rb +80 -0
- data/bin/main/VR_Main.rb +313 -0
- data/bin/main/VR_Remote_Gem_Tree.rb +70 -0
- data/bin/main/glade/NewProjectGUI.glade +141 -0
- data/bin/main/glade/ProjectChooserGUI.glade +140 -0
- data/bin/main/glade/RubygemsAPI.glade +130 -0
- data/bin/main/glade/Splash.glade +18 -0
- data/bin/main/glade/VR_ENV.glade +168 -0
- data/bin/main/glade/VR_ENV_GLOBAL.glade +268 -0
- data/bin/main/glade/VR_File_Tree.glade +65 -0
- data/bin/main/glade/VR_Local_Gem_Tree.glade +45 -0
- data/bin/main/glade/VR_Main.glade +707 -0
- data/bin/main/glade/VR_Remote_Gem_Tree.glade +76 -0
- data/bin/tools/VR_Tools.rb +120 -0
- data/img/close.png +0 -0
- data/img/folder.png +0 -0
- data/img/glade.png +0 -0
- data/img/gtk-edit.png +0 -0
- data/img/obj.png +0 -0
- data/img/png.png +0 -0
- data/img/rb.png +0 -0
- data/img/ruby.png +0 -0
- data/img/splash.png +0 -0
- data/img/unknown.png +0 -0
- data/skeleton/document/New.glade +13 -0
- data/skeleton/document/NewWindow.rb +15 -0
- data/skeleton/project/bin/MyClass.rb +15 -0
- data/skeleton/project/bin/glade/MyClass.glade +45 -0
- data/skeleton/project/main.rb +14 -0
- data/visualruby_examples/active_record/.vr_settings.yaml +47 -0
- data/visualruby_examples/active_record/active_record.rb +52 -0
- data/visualruby_examples/active_record/bin/ChoosePerson.rb +17 -0
- data/visualruby_examples/active_record/bin/Person.rb +13 -0
- data/visualruby_examples/active_record/bin/glade/ChoosePerson.glade +61 -0
- data/visualruby_examples/active_record/bin/glade/Person.glade +148 -0
- data/visualruby_examples/active_record/db/development.sqlite3 +0 -0
- data/visualruby_examples/active_record2/.vr_settings.yaml +48 -0
- data/visualruby_examples/active_record2/active_record2.rb +142 -0
- data/visualruby_examples/active_record2/bin/CompanyGUI.rb +54 -0
- data/visualruby_examples/active_record2/bin/Employee.rb +20 -0
- data/visualruby_examples/active_record2/bin/Employer.rb +11 -0
- data/visualruby_examples/active_record2/bin/Paycheck.rb +11 -0
- data/visualruby_examples/active_record2/bin/glade/CompanyGUI.glade +167 -0
- data/visualruby_examples/active_record2/bin/glade/Employee.glade +123 -0
- data/visualruby_examples/active_record2/bin/glade/Employer.glade +147 -0
- data/visualruby_examples/active_record2/bin/glade/Paycheck.glade +145 -0
- data/visualruby_examples/active_record2/db/development.sqlite3 +0 -0
- data/visualruby_examples/all_widgets/.vr_settings.yaml +20 -0
- data/visualruby_examples/all_widgets/all_widgets.rb +13 -0
- data/visualruby_examples/all_widgets/bin/AllWidgets.rb +43 -0
- data/visualruby_examples/all_widgets/bin/glade/AllWidgets.glade +166 -0
- data/visualruby_examples/all_widgets/bin/splash.png +0 -0
- data/visualruby_examples/calculator/.vr_settings.yaml +21 -0
- data/visualruby_examples/calculator/bin/Calculator.rb +63 -0
- data/visualruby_examples/calculator/bin/glade/Calculator.glade +243 -0
- data/visualruby_examples/calculator/main.rb +13 -0
- data/visualruby_examples/child_window/.vr_settings.yaml +46 -0
- data/visualruby_examples/child_window/bin/ChildWindowDemo.rb +41 -0
- data/visualruby_examples/child_window/bin/MyChildClass.rb +42 -0
- data/visualruby_examples/child_window/bin/glade/ChildWindowDemo.glade +101 -0
- data/visualruby_examples/child_window/bin/glade/MyChildClass.glade +58 -0
- data/visualruby_examples/child_window/main.rb +13 -0
- data/visualruby_examples/drag_drop/.vr_settings.yaml +19 -0
- data/visualruby_examples/drag_drop/bin/DragDropDemo.rb +45 -0
- data/visualruby_examples/drag_drop/bin/glade/DragDropDemo.glade +143 -0
- data/visualruby_examples/drag_drop/img/folder.png +0 -0
- data/visualruby_examples/drag_drop/img/glade.png +0 -0
- data/visualruby_examples/drag_drop/img/gtk-edit.png +0 -0
- data/visualruby_examples/drag_drop/img/obj.png +0 -0
- data/visualruby_examples/drag_drop/img/png.png +0 -0
- data/visualruby_examples/drag_drop/img/rb.png +0 -0
- data/visualruby_examples/drag_drop/img/ruby.png +0 -0
- data/visualruby_examples/drag_drop/img/unknown.png +0 -0
- data/visualruby_examples/drag_drop/main.rb +14 -0
- data/visualruby_examples/listview/.vr_settings.yaml +46 -0
- data/visualruby_examples/listview/bin/SongListView.rb +89 -0
- data/visualruby_examples/listview/bin/SongListViewGUI.rb +67 -0
- data/visualruby_examples/listview/bin/audio-x-generic.png +0 -0
- data/visualruby_examples/listview/bin/glade/SongListViewGUI.glade +220 -0
- data/visualruby_examples/listview/main.rb +19 -0
- data/visualruby_examples/listview_objects/.vr_settings.yaml +46 -0
- data/visualruby_examples/listview_objects/bin/DataObject.rb +32 -0
- data/visualruby_examples/listview_objects/bin/DataObjectGUI.rb +41 -0
- data/visualruby_examples/listview_objects/bin/ListViewObjects.rb +34 -0
- data/visualruby_examples/listview_objects/bin/ListViewObjectsGUI.rb +18 -0
- data/visualruby_examples/listview_objects/bin/glade/DataObject.glade +198 -0
- data/visualruby_examples/listview_objects/bin/glade/ListViewObjectsGUI.glade +102 -0
- data/visualruby_examples/listview_objects/main.rb +13 -0
- data/visualruby_examples/simple_ruby_gui/.vr_settings.yaml +45 -0
- data/visualruby_examples/simple_ruby_gui/bin/DataObjectGUI.rb +20 -0
- data/visualruby_examples/simple_ruby_gui/bin/glade/DataObjectGUI.glade +163 -0
- data/visualruby_examples/simple_ruby_gui/simple_ruby_gui +16 -0
- data/visualruby_examples/treeview/.vr_settings.yaml +18 -0
- data/visualruby_examples/treeview/bin/MyClass.rb +28 -0
- data/visualruby_examples/treeview/bin/glade/MyClass.glade +48 -0
- data/visualruby_examples/treeview/main.rb +14 -0
- data/vr +40 -0
- metadata +202 -0
data/bin/main/VR_Main.rb
ADDED
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
|
|
2
|
+
class VR_Main
|
|
3
|
+
|
|
4
|
+
include GladeGUI
|
|
5
|
+
|
|
6
|
+
attr_accessor :proj_path, :tabs, :shell, :builder, :file_tree
|
|
7
|
+
|
|
8
|
+
def initialize(argv)
|
|
9
|
+
@proj_path = argv[0] == "new" ? new_project(argv[1]) : argv[0]
|
|
10
|
+
@proj_path = @proj_path == nil ? Dir.pwd : @proj_path.chomp("/")
|
|
11
|
+
@proj_path = ENV["HOME"] unless File.split(@proj_path).length >= 2 and File.directory?(@proj_path)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def before_show
|
|
15
|
+
# splash = Splash.new
|
|
16
|
+
# splash.show(self)
|
|
17
|
+
@file_tree = VR_File_Tree.new(self, File.expand_path(File.dirname(__FILE__) + "/../../img"))
|
|
18
|
+
@builder["scrolledwindowFileTree"].add(@file_tree)
|
|
19
|
+
|
|
20
|
+
#add document notebook
|
|
21
|
+
@tabs = VR_Tabs.new(self)
|
|
22
|
+
@builder["vboxTabs"].add(@tabs)
|
|
23
|
+
|
|
24
|
+
#add shell textview
|
|
25
|
+
@shell = VR_TextShell.new(@tabs)
|
|
26
|
+
@builder["scrollShell"].add(@shell)
|
|
27
|
+
|
|
28
|
+
#add local gem tab
|
|
29
|
+
@gem_tree = VR_Local_Gem_Tree.new(self)
|
|
30
|
+
@builder['scrolledLocalGems'].add(@gem_tree)
|
|
31
|
+
#add remote gem tab
|
|
32
|
+
@remote_gem_tree = VR_Remote_Gem_Tree.new(self)
|
|
33
|
+
@builder["scrolledRemoteGems"].add(@remote_gem_tree)
|
|
34
|
+
|
|
35
|
+
menuInstallExamples__activate if not File.directory?(File.join(ENV["HOME"],"","visualruby", "examples", "drag_drop"))
|
|
36
|
+
|
|
37
|
+
if Dir.entries(@proj_path).join == "..." #empty
|
|
38
|
+
VR_Tools.copy_recursively(File.dirname(__FILE__) + "/../../skeleton/project", @proj_path)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
if not File.file?(@proj_path + "/" + VR_ENV::SETTINGS_FILE)
|
|
42
|
+
menuInstallExamples__activate if Dir.glob(ENV["HOME"] + File.join( "", "**", VR_ENV::SETTINGS_FILE)).size == 0
|
|
43
|
+
toolOpenFolder_clicked
|
|
44
|
+
else
|
|
45
|
+
load_project(@proj_path)
|
|
46
|
+
end
|
|
47
|
+
# splash.destroy_window()cvnc
|
|
48
|
+
# show_window() if not $VR_ENV.nil?
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def project_valid?(proj_path)
|
|
52
|
+
return false if proj_path.nil?
|
|
53
|
+
if not File.directory?(proj_path.to_s)
|
|
54
|
+
VR::Dialog.message_box("This folder is invalid:\n\n" + proj_path)
|
|
55
|
+
return false
|
|
56
|
+
end
|
|
57
|
+
if ENV["HOME"] == proj_path
|
|
58
|
+
return false
|
|
59
|
+
end
|
|
60
|
+
if Dir.entries(proj_path).join == "..." #empty
|
|
61
|
+
VR_Tools.copy_recursively(File.dirname(__FILE__) + "/../../skeleton/project", proj_path)
|
|
62
|
+
return true
|
|
63
|
+
elsif not File.file?(proj_path + "/" + VR_ENV::SETTINGS_FILE)
|
|
64
|
+
return VR::Dialog.ok_box("No Visual Ruby project file was found in this folder:\n " + proj_path + " Do you wan to open it anyway?")
|
|
65
|
+
end #success!
|
|
66
|
+
return true
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def load_project(proj_path) #assumes valid_project? is true
|
|
70
|
+
FileUtils.cd(proj_path)
|
|
71
|
+
@builder['window1'].title = "VR: " + File.basename(Dir.pwd)
|
|
72
|
+
@builder["labelStatus"].label = Dir.pwd
|
|
73
|
+
$VR_ENV = VR_ENV.load_yaml()
|
|
74
|
+
$VR_ENV_GLOBAL = VR_ENV_GLOBAL.load_yaml()
|
|
75
|
+
@file_tree.refresh()
|
|
76
|
+
load_state()
|
|
77
|
+
@shell.buffer.text = ""
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def new_project(proj_path)
|
|
81
|
+
return nil unless proj_path
|
|
82
|
+
path = File.join(Dir.pwd,proj_path)
|
|
83
|
+
FileUtils.mkdir(path) unless File.directory?(path)
|
|
84
|
+
return path
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def toolBack_clicked
|
|
90
|
+
@tabs.back()
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def toolOpenFolder_clicked
|
|
97
|
+
save_state
|
|
98
|
+
return unless @tabs.try_to_save_all()
|
|
99
|
+
old_path = @proj_path
|
|
100
|
+
ProjectChooserGUI.new(self).show() #modal stops execution here, sets @proj_path
|
|
101
|
+
# return if @proj_path == old_path #first time needs to be ok
|
|
102
|
+
if project_valid?(@proj_path)
|
|
103
|
+
@tabs.try_to_close_all()
|
|
104
|
+
load_project(@proj_path)
|
|
105
|
+
else
|
|
106
|
+
@proj_path = old_path
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def notebookTree_changed #file, gem notebook
|
|
111
|
+
case @builder['notebookTree'].page
|
|
112
|
+
when 1 then @gem_tree.refresh()
|
|
113
|
+
when 2 then @remote_gem_tree.refresh(false) #false = don't force refresh
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def window1_key_press(win, key)
|
|
118
|
+
case x = key.keyval
|
|
119
|
+
when 65474 then toolRun_clicked # F5
|
|
120
|
+
# when 115 then toolSave_clicked # Ctrl-S
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def menuCreateLauncher__activate(*a)
|
|
125
|
+
VR_Tools.create_desktop_launcher
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def menuCloseAll__activate(*a)
|
|
129
|
+
@tabs.try_to_close_all()
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def menuSettings__activate(*a)
|
|
133
|
+
$VR_ENV.show()
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def menuGlobalSettings__activate(*a)
|
|
137
|
+
$VR_ENV_GLOBAL.show()
|
|
138
|
+
@tabs.update_style_all()
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def menuWWWRubygems__activate(*a)
|
|
142
|
+
VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} https://rubygems.org/users/new")
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def menuSaveAll__activate(*a)
|
|
146
|
+
@tabs.try_to_save_all(false) # don't prompt
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
def menuNew__activate(*a)
|
|
150
|
+
@tabs.load_tab()
|
|
151
|
+
end
|
|
152
|
+
def menuSaveAs__activate(*a)
|
|
153
|
+
@tabs.docs[@tabs.page].save_as()
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def toolRefresh_clicked
|
|
157
|
+
case @builder['notebookTree'].page
|
|
158
|
+
when 0 then @file_tree.refresh()
|
|
159
|
+
when 1 then @gem_tree.refresh()
|
|
160
|
+
when 2 then @remote_gem_tree.refresh()
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def toolSave_clicked() # saves open tab
|
|
165
|
+
@tabs.docs[@tabs.page].try_to_save(false)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
#returns false to abort!
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def menuNewWindow__activate(*a)
|
|
173
|
+
fn = File.dirname(__FILE__) + "/../../skeleton/document/NewWindow.rb"
|
|
174
|
+
@tabs.load_tab()
|
|
175
|
+
@tabs.set_contents(File.open(fn).read)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
def menuNewProject__activate(*a)
|
|
179
|
+
save_state
|
|
180
|
+
return unless @tabs.try_to_save_all()
|
|
181
|
+
old_path = @proj_path
|
|
182
|
+
NewProjectGUI.new(self).show
|
|
183
|
+
if project_valid?(@proj_path)
|
|
184
|
+
@tabs.try_to_close_all()
|
|
185
|
+
load_project(@proj_path)
|
|
186
|
+
else
|
|
187
|
+
@proj_path = old_path
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def toolBackUp_clicked
|
|
192
|
+
return unless @tabs.try_to_save_all()
|
|
193
|
+
# path = File.join(ENV["HOME"], "visualruby_backup", Dir.pwd.gsub(ENV["HOME"], ""))
|
|
194
|
+
VR_Tools.back_up()
|
|
195
|
+
# VR::Dialog.message_box("Files backed up to: \n\n" + path)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# def toolBackUp_clicked
|
|
199
|
+
# return unless @tabs.try_to_save_all()
|
|
200
|
+
# path = $VR_ENV.backup_path
|
|
201
|
+
# return if path.nil?
|
|
202
|
+
# if File.directory?(path) and path.gsub('\\', '/').include?(ENV["HOME"])
|
|
203
|
+
# VR_Tools.back_up(Dir.pwd, path)
|
|
204
|
+
# VR::Dialog.message_box("Files backed up to: \n\n" + path)
|
|
205
|
+
# else
|
|
206
|
+
# VR::Dialog.message_box("Backup path must be subdirecory of #{ENV['HOME']}:\n\n InValid: " + path)
|
|
207
|
+
# menuSettings__activate
|
|
208
|
+
# end
|
|
209
|
+
# end
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def toolIndent_clicked
|
|
213
|
+
@tabs.docs[@tabs.page].indent($VR_ENV_GLOBAL.tab_spaces)
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def toolUnIndent_clicked
|
|
217
|
+
@tabs.docs[@tabs.page].unindent($VR_ENV_GLOBAL.tab_spaces)
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
def toolComment_clicked
|
|
221
|
+
@tabs.docs[@tabs.page].comment()
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
def toolUnComment_clicked
|
|
225
|
+
@tabs.docs[@tabs.page].un_comment()
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
def toolRun_clicked
|
|
229
|
+
run_command($VR_ENV.run_command_line)
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
def run_command(cmd)
|
|
233
|
+
save_state()
|
|
234
|
+
return unless @tabs.try_to_save_all(false) # false = don't prompt for changes to files
|
|
235
|
+
cur_dir = Dir.pwd
|
|
236
|
+
result = "\n#{cur_dir}$ #{cmd}\n"
|
|
237
|
+
result += `#{cmd} 2>&1`
|
|
238
|
+
FileUtils.cd(cur_dir)
|
|
239
|
+
@shell.hilight_links(result, true)
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
def save_state
|
|
243
|
+
return if $VR_ENV == nil
|
|
244
|
+
$VR_ENV.width, $VR_ENV.height = @builder["window1"].size()
|
|
245
|
+
$VR_ENV.panel_pos = @builder["panelMain"].position
|
|
246
|
+
$VR_ENV.open_folders = @file_tree.get_open_folders()
|
|
247
|
+
$VR_ENV.open_files = @tabs.get_open_fn()
|
|
248
|
+
$VR_ENV.current_file = @tabs.docs[@tabs.page].full_path_file
|
|
249
|
+
$VR_ENV.save_yaml()
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
def load_state
|
|
253
|
+
@builder["window1"].resize($VR_ENV.width, $VR_ENV.height)
|
|
254
|
+
@builder['panelMain'].set_position($VR_ENV.panel_pos)
|
|
255
|
+
@builder["window1"].visible = true
|
|
256
|
+
@tabs.open_file_names($VR_ENV.open_files)
|
|
257
|
+
@tabs.switch_to($VR_ENV.current_file)
|
|
258
|
+
@file_tree.open_folders($VR_ENV.open_folders)
|
|
259
|
+
@builder["window1"].show_all
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
def menuCreateGemspec__activate(*a)
|
|
263
|
+
if file_name = VR_Tools.create_gemspec()
|
|
264
|
+
@tabs.destroy_file_tab(file_name)
|
|
265
|
+
@tabs.load_tab(file_name)
|
|
266
|
+
@file_tree.insert(file_name)
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
def buttonNext_clicked
|
|
271
|
+
@shell.jump_to()
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
def buttonFind_clicked
|
|
275
|
+
str = @builder["entryFind"].text
|
|
276
|
+
str = str.length < 2 ? @tabs.docs[@tabs.page].selected_text() : str
|
|
277
|
+
return if str.length < 2
|
|
278
|
+
text = (@builder["radioOnDisk"].active?) ? @tabs.find_in_all(str) : @tabs.find_in_tabs(str)
|
|
279
|
+
@shell.hilight_links(text, false)
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
def buttonReplace_clicked
|
|
283
|
+
@tabs.docs[@tabs.page].replace(@builder["entryReplace"].text)
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
def entryFind_key_press(me, evt)
|
|
287
|
+
return if evt.keyval != 65293 #enter key
|
|
288
|
+
buttonFind_clicked
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
def menuTutorials__activate(*a)
|
|
292
|
+
VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} http://www.visualruby.net")
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
def menuInstallExamples__activate(*a)
|
|
296
|
+
path = File.join(ENV["HOME"], "", "visualruby", "examples")
|
|
297
|
+
VR_Tools.copy_recursively(File.expand_path(File.join(File.dirname(__FILE__),"","..","..","visualruby_examples")), path)
|
|
298
|
+
VR::Dialog.message_box("The example projects are installed in:\n#{path}\nIf you want to uninstall them, just delete the folder.\n\nUse the /home/visualruby folder for all your visualruby projects.")
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
#needed so tabs can be saved
|
|
302
|
+
def on_window1_delete_event
|
|
303
|
+
save_state
|
|
304
|
+
return true unless @tabs.try_to_save_all()
|
|
305
|
+
return false #ok to close
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
def destroy_window()
|
|
309
|
+
super
|
|
310
|
+
# exit! # note exit makes it not spit out buffer
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
|
|
2
|
+
class VR_Remote_Gem_Tree < GemTree
|
|
3
|
+
|
|
4
|
+
# PIX = Gdk::Pixbuf.new(File.dirname(__FILE__) + '/../../img/rb.png')
|
|
5
|
+
|
|
6
|
+
include GladeGUI
|
|
7
|
+
|
|
8
|
+
def initialize(main)
|
|
9
|
+
super()
|
|
10
|
+
@main = main
|
|
11
|
+
# set_title(PIX => "Gems on rubygems.org")
|
|
12
|
+
@gems = Hash.new
|
|
13
|
+
load_glade(__FILE__, main)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def refresh(force = true)
|
|
18
|
+
return if @t
|
|
19
|
+
return unless force or not self.model.iter_first
|
|
20
|
+
return unless @api.get_key()
|
|
21
|
+
@t = Thread.new do
|
|
22
|
+
@main.shell.buffer.text += "\nContacting rubygems.org..."
|
|
23
|
+
self.model.clear
|
|
24
|
+
return unless @gems = @api.get_obj_url("/api/v1/gems.yaml")
|
|
25
|
+
@gems.each do |gem|
|
|
26
|
+
gem_info = @api.get_obj_url("/api/v1/versions/#{gem['name']}.yaml")
|
|
27
|
+
gem_info.each do |info|
|
|
28
|
+
self.add_row(:pix => RUBY_ICON, :gem => "#{gem['name']} (#{info['number']})")
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
@t.join
|
|
32
|
+
end
|
|
33
|
+
@t = false
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def selected_gem
|
|
37
|
+
row = self.selection.selected[1].split(" (")
|
|
38
|
+
# ver = row[1].gsub(")","")
|
|
39
|
+
@gems.detect { |gem| gem['name'] == row[0] } #and gem['version'] == ver}
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def popOpenRubygemsPage_clicked
|
|
43
|
+
gem = selected_gem()
|
|
44
|
+
VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} #{gem['project_uri']}")
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def popOpenHomepage_clicked
|
|
48
|
+
gem = selected_gem()
|
|
49
|
+
VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} #{gem['homepage_uri']}")
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# def remoteGemTree_rclicked(w, event)
|
|
53
|
+
# if event.event_type == Gdk::Event::BUTTON_RELEASE
|
|
54
|
+
# if event.button == 3 # right mouse button
|
|
55
|
+
# @builder['popGemRemote'].popup(nil, nil, event.button, event.time)
|
|
56
|
+
# end
|
|
57
|
+
# end
|
|
58
|
+
# end
|
|
59
|
+
|
|
60
|
+
def popYank_clicked
|
|
61
|
+
name, ver = get_name_ver(selection.selected[1])
|
|
62
|
+
reply = @api.yank_gem(name, ver)
|
|
63
|
+
@main.shell.buffer.text = "Yanking gem: #{name} #{ver}\n" + reply
|
|
64
|
+
self.model.remove(selection.selected) if reply.include? "OK"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
#
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<interface>
|
|
3
|
+
<requires lib="gtk+" version="2.16"/>
|
|
4
|
+
<!-- interface-naming-policy project-wide -->
|
|
5
|
+
<object class="GtkWindow" id="window1">
|
|
6
|
+
<property name="visible">True</property>
|
|
7
|
+
<property name="can_focus">False</property>
|
|
8
|
+
<property name="modal">True</property>
|
|
9
|
+
<property name="default_width">450</property>
|
|
10
|
+
<property name="default_height">300</property>
|
|
11
|
+
<signal name="destroy" handler="destroy_window" swapped="no"/>
|
|
12
|
+
<child>
|
|
13
|
+
<object class="GtkHBox" id="hbox1">
|
|
14
|
+
<property name="visible">True</property>
|
|
15
|
+
<property name="can_focus">False</property>
|
|
16
|
+
<child>
|
|
17
|
+
<object class="GtkVBox" id="vbox1">
|
|
18
|
+
<property name="visible">True</property>
|
|
19
|
+
<property name="can_focus">False</property>
|
|
20
|
+
<child>
|
|
21
|
+
<object class="GtkLabel" id="label1">
|
|
22
|
+
<property name="visible">True</property>
|
|
23
|
+
<property name="can_focus">False</property>
|
|
24
|
+
<property name="label" translatable="yes"><big><big>Create New Project</big></big></property>
|
|
25
|
+
<property name="use_markup">True</property>
|
|
26
|
+
</object>
|
|
27
|
+
<packing>
|
|
28
|
+
<property name="expand">True</property>
|
|
29
|
+
<property name="fill">True</property>
|
|
30
|
+
<property name="position">0</property>
|
|
31
|
+
</packing>
|
|
32
|
+
</child>
|
|
33
|
+
<child>
|
|
34
|
+
<object class="GtkLabel" id="label2">
|
|
35
|
+
<property name="visible">True</property>
|
|
36
|
+
<property name="can_focus">False</property>
|
|
37
|
+
<property name="label" translatable="yes">Enter the name for your new project. A directory will be created under your /home/visualruby directory with that name. Use only letters and underscores.
|
|
38
|
+
|
|
39
|
+
You are free to move the project later.</property>
|
|
40
|
+
<property name="wrap">True</property>
|
|
41
|
+
</object>
|
|
42
|
+
<packing>
|
|
43
|
+
<property name="expand">True</property>
|
|
44
|
+
<property name="fill">True</property>
|
|
45
|
+
<property name="position">1</property>
|
|
46
|
+
</packing>
|
|
47
|
+
</child>
|
|
48
|
+
<child>
|
|
49
|
+
<object class="GtkTable" id="table1">
|
|
50
|
+
<property name="visible">True</property>
|
|
51
|
+
<property name="can_focus">False</property>
|
|
52
|
+
<property name="n_rows">2</property>
|
|
53
|
+
<property name="n_columns">2</property>
|
|
54
|
+
<child>
|
|
55
|
+
<object class="GtkEntry" id="entryFolderName">
|
|
56
|
+
<property name="visible">True</property>
|
|
57
|
+
<property name="can_focus">True</property>
|
|
58
|
+
<property name="invisible_char">•</property>
|
|
59
|
+
<property name="invisible_char_set">True</property>
|
|
60
|
+
<property name="primary_icon_activatable">False</property>
|
|
61
|
+
<property name="secondary_icon_activatable">False</property>
|
|
62
|
+
<property name="primary_icon_sensitive">True</property>
|
|
63
|
+
<property name="secondary_icon_sensitive">True</property>
|
|
64
|
+
</object>
|
|
65
|
+
<packing>
|
|
66
|
+
<property name="left_attach">1</property>
|
|
67
|
+
<property name="right_attach">2</property>
|
|
68
|
+
</packing>
|
|
69
|
+
</child>
|
|
70
|
+
<child>
|
|
71
|
+
<object class="GtkLabel" id="label3">
|
|
72
|
+
<property name="visible">True</property>
|
|
73
|
+
<property name="can_focus">False</property>
|
|
74
|
+
<property name="xalign">1</property>
|
|
75
|
+
<property name="label" translatable="yes">/home/visualruby/</property>
|
|
76
|
+
</object>
|
|
77
|
+
</child>
|
|
78
|
+
<child>
|
|
79
|
+
<object class="GtkHButtonBox" id="hbuttonbox1">
|
|
80
|
+
<property name="visible">True</property>
|
|
81
|
+
<property name="can_focus">False</property>
|
|
82
|
+
<property name="layout_style">spread</property>
|
|
83
|
+
<child>
|
|
84
|
+
<object class="GtkButton" id="buttonCreate">
|
|
85
|
+
<property name="label" translatable="yes">Create Project</property>
|
|
86
|
+
<property name="visible">True</property>
|
|
87
|
+
<property name="can_focus">True</property>
|
|
88
|
+
<property name="receives_default">True</property>
|
|
89
|
+
<property name="use_action_appearance">False</property>
|
|
90
|
+
</object>
|
|
91
|
+
<packing>
|
|
92
|
+
<property name="expand">False</property>
|
|
93
|
+
<property name="fill">False</property>
|
|
94
|
+
<property name="position">0</property>
|
|
95
|
+
</packing>
|
|
96
|
+
</child>
|
|
97
|
+
<child>
|
|
98
|
+
<object class="GtkButton" id="buttonCancel">
|
|
99
|
+
<property name="label" translatable="yes">Cancel</property>
|
|
100
|
+
<property name="visible">True</property>
|
|
101
|
+
<property name="can_focus">True</property>
|
|
102
|
+
<property name="receives_default">True</property>
|
|
103
|
+
<property name="use_action_appearance">False</property>
|
|
104
|
+
</object>
|
|
105
|
+
<packing>
|
|
106
|
+
<property name="expand">False</property>
|
|
107
|
+
<property name="fill">False</property>
|
|
108
|
+
<property name="position">1</property>
|
|
109
|
+
</packing>
|
|
110
|
+
</child>
|
|
111
|
+
</object>
|
|
112
|
+
<packing>
|
|
113
|
+
<property name="left_attach">1</property>
|
|
114
|
+
<property name="right_attach">2</property>
|
|
115
|
+
<property name="top_attach">1</property>
|
|
116
|
+
<property name="bottom_attach">2</property>
|
|
117
|
+
</packing>
|
|
118
|
+
</child>
|
|
119
|
+
<child>
|
|
120
|
+
<placeholder/>
|
|
121
|
+
</child>
|
|
122
|
+
</object>
|
|
123
|
+
<packing>
|
|
124
|
+
<property name="expand">True</property>
|
|
125
|
+
<property name="fill">True</property>
|
|
126
|
+
<property name="padding">12</property>
|
|
127
|
+
<property name="position">2</property>
|
|
128
|
+
</packing>
|
|
129
|
+
</child>
|
|
130
|
+
</object>
|
|
131
|
+
<packing>
|
|
132
|
+
<property name="expand">True</property>
|
|
133
|
+
<property name="fill">True</property>
|
|
134
|
+
<property name="padding">17</property>
|
|
135
|
+
<property name="position">0</property>
|
|
136
|
+
</packing>
|
|
137
|
+
</child>
|
|
138
|
+
</object>
|
|
139
|
+
</child>
|
|
140
|
+
</object>
|
|
141
|
+
</interface>
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<interface>
|
|
3
|
+
<requires lib="gtk+" version="2.16"/>
|
|
4
|
+
<!-- interface-naming-policy project-wide -->
|
|
5
|
+
<object class="GtkWindow" id="window1">
|
|
6
|
+
<property name="width_request">700</property>
|
|
7
|
+
<property name="height_request">700</property>
|
|
8
|
+
<property name="visible">True</property>
|
|
9
|
+
<property name="can_focus">False</property>
|
|
10
|
+
<property name="title" translatable="yes">Select Visual Ruby Project Root</property>
|
|
11
|
+
<property name="modal">True</property>
|
|
12
|
+
<property name="default_width">800</property>
|
|
13
|
+
<property name="default_height">800</property>
|
|
14
|
+
<signal name="destroy" handler="destroy_window" swapped="no"/>
|
|
15
|
+
<child>
|
|
16
|
+
<object class="GtkVBox" id="vbox1">
|
|
17
|
+
<property name="visible">True</property>
|
|
18
|
+
<property name="can_focus">False</property>
|
|
19
|
+
<property name="spacing">10</property>
|
|
20
|
+
<child>
|
|
21
|
+
<object class="GtkLabel" id="label1">
|
|
22
|
+
<property name="visible">True</property>
|
|
23
|
+
<property name="can_focus">False</property>
|
|
24
|
+
<property name="label" translatable="yes"><big>Select from the existing projects, or open a new one.</big></property>
|
|
25
|
+
<property name="use_markup">True</property>
|
|
26
|
+
</object>
|
|
27
|
+
<packing>
|
|
28
|
+
<property name="expand">False</property>
|
|
29
|
+
<property name="fill">True</property>
|
|
30
|
+
<property name="padding">9</property>
|
|
31
|
+
<property name="position">0</property>
|
|
32
|
+
</packing>
|
|
33
|
+
</child>
|
|
34
|
+
<child>
|
|
35
|
+
<object class="GtkHBox" id="hbox1">
|
|
36
|
+
<property name="visible">True</property>
|
|
37
|
+
<property name="can_focus">False</property>
|
|
38
|
+
<child>
|
|
39
|
+
<object class="GtkScrolledWindow" id="scrolledwindowProjTree">
|
|
40
|
+
<property name="visible">True</property>
|
|
41
|
+
<property name="can_focus">True</property>
|
|
42
|
+
<property name="hscrollbar_policy">automatic</property>
|
|
43
|
+
<property name="vscrollbar_policy">automatic</property>
|
|
44
|
+
<child>
|
|
45
|
+
<placeholder/>
|
|
46
|
+
</child>
|
|
47
|
+
</object>
|
|
48
|
+
<packing>
|
|
49
|
+
<property name="expand">True</property>
|
|
50
|
+
<property name="fill">True</property>
|
|
51
|
+
<property name="padding">20</property>
|
|
52
|
+
<property name="position">0</property>
|
|
53
|
+
</packing>
|
|
54
|
+
</child>
|
|
55
|
+
</object>
|
|
56
|
+
<packing>
|
|
57
|
+
<property name="expand">True</property>
|
|
58
|
+
<property name="fill">True</property>
|
|
59
|
+
<property name="position">1</property>
|
|
60
|
+
</packing>
|
|
61
|
+
</child>
|
|
62
|
+
<child>
|
|
63
|
+
<object class="GtkHButtonBox" id="hbuttonbox1">
|
|
64
|
+
<property name="visible">True</property>
|
|
65
|
+
<property name="can_focus">False</property>
|
|
66
|
+
<property name="spacing">11</property>
|
|
67
|
+
<property name="layout_style">center</property>
|
|
68
|
+
<child>
|
|
69
|
+
<object class="GtkCheckButton" id="checkBackup">
|
|
70
|
+
<property name="label" translatable="yes">Show Backup</property>
|
|
71
|
+
<property name="visible">True</property>
|
|
72
|
+
<property name="can_focus">True</property>
|
|
73
|
+
<property name="receives_default">False</property>
|
|
74
|
+
<property name="use_action_appearance">False</property>
|
|
75
|
+
<property name="draw_indicator">True</property>
|
|
76
|
+
<signal name="toggled" handler="checkBackup_toggled" swapped="no"/>
|
|
77
|
+
</object>
|
|
78
|
+
<packing>
|
|
79
|
+
<property name="expand">False</property>
|
|
80
|
+
<property name="fill">False</property>
|
|
81
|
+
<property name="padding">5</property>
|
|
82
|
+
<property name="position">0</property>
|
|
83
|
+
</packing>
|
|
84
|
+
</child>
|
|
85
|
+
<child>
|
|
86
|
+
<object class="GtkButton" id="buttonSelect">
|
|
87
|
+
<property name="label" translatable="yes">Select Folder</property>
|
|
88
|
+
<property name="visible">True</property>
|
|
89
|
+
<property name="can_focus">True</property>
|
|
90
|
+
<property name="receives_default">True</property>
|
|
91
|
+
<property name="use_action_appearance">False</property>
|
|
92
|
+
<signal name="clicked" handler="buttonSelect_clicked" swapped="no"/>
|
|
93
|
+
</object>
|
|
94
|
+
<packing>
|
|
95
|
+
<property name="expand">False</property>
|
|
96
|
+
<property name="fill">False</property>
|
|
97
|
+
<property name="position">1</property>
|
|
98
|
+
</packing>
|
|
99
|
+
</child>
|
|
100
|
+
<child>
|
|
101
|
+
<object class="GtkButton" id="buttonCancel">
|
|
102
|
+
<property name="label" translatable="yes">Cancel</property>
|
|
103
|
+
<property name="visible">True</property>
|
|
104
|
+
<property name="can_focus">True</property>
|
|
105
|
+
<property name="receives_default">True</property>
|
|
106
|
+
<property name="use_action_appearance">False</property>
|
|
107
|
+
<signal name="clicked" handler="destroy_window" swapped="no"/>
|
|
108
|
+
</object>
|
|
109
|
+
<packing>
|
|
110
|
+
<property name="expand">False</property>
|
|
111
|
+
<property name="fill">False</property>
|
|
112
|
+
<property name="position">2</property>
|
|
113
|
+
</packing>
|
|
114
|
+
</child>
|
|
115
|
+
<child>
|
|
116
|
+
<object class="GtkButton" id="buttonOpen">
|
|
117
|
+
<property name="label" translatable="yes">Open</property>
|
|
118
|
+
<property name="visible">True</property>
|
|
119
|
+
<property name="can_focus">True</property>
|
|
120
|
+
<property name="receives_default">True</property>
|
|
121
|
+
<property name="use_action_appearance">False</property>
|
|
122
|
+
</object>
|
|
123
|
+
<packing>
|
|
124
|
+
<property name="expand">False</property>
|
|
125
|
+
<property name="fill">False</property>
|
|
126
|
+
<property name="position">3</property>
|
|
127
|
+
</packing>
|
|
128
|
+
</child>
|
|
129
|
+
</object>
|
|
130
|
+
<packing>
|
|
131
|
+
<property name="expand">False</property>
|
|
132
|
+
<property name="fill">True</property>
|
|
133
|
+
<property name="padding">10</property>
|
|
134
|
+
<property name="position">2</property>
|
|
135
|
+
</packing>
|
|
136
|
+
</child>
|
|
137
|
+
</object>
|
|
138
|
+
</child>
|
|
139
|
+
</object>
|
|
140
|
+
</interface>
|