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/main/VR_Main.rb
CHANGED
|
@@ -1,292 +1,294 @@
|
|
|
1
1
|
class VR_Main
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def initialize(argv)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
3
|
+
include GladeGUI
|
|
4
|
+
|
|
5
|
+
attr_accessor :proj_path, :tabs, :shell, :builder, :file_tree
|
|
6
|
+
|
|
7
|
+
def initialize(argv, splash)
|
|
8
|
+
@splash = splash
|
|
9
|
+
@proj_path = argv[0] ? argv[0] : Dir.pwd
|
|
10
|
+
@proj_path = @proj_path.chomp("/")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def before_show
|
|
14
|
+
# there must be a visualruby directory:
|
|
15
|
+
menuInstallExamples__activate if not File.directory?(File.join(ENV["HOME"],"","visualruby", "examples","drag_drop"))
|
|
16
|
+
# load global settings (requires /home/visuaruby folder exists
|
|
17
|
+
$VR_ENV_GLOBAL = VR::load_yaml(:class => VR_ENV_GLOBAL, :file_name => VR_ENV_GLOBAL::GLOBAL_SETTINGS_FILE)
|
|
18
|
+
# try to open right project
|
|
19
|
+
|
|
20
|
+
if not project_valid?(@proj_path)
|
|
21
|
+
@proj_path = $VR_ENV_GLOBAL.default_project if project_valid?($VR_ENV_GLOBAL.default_project)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
@file_tree = VR_File_Tree.new(self, File.expand_path(File.dirname(__FILE__) + "/../../img"))
|
|
25
|
+
@builder["scrolledwindowFileTree"].add(@file_tree)
|
|
26
|
+
|
|
27
|
+
#add document notebook
|
|
28
|
+
@tabs = VR_Tabs.new(self)
|
|
29
|
+
@builder["boxTabs"].add(@tabs)
|
|
29
30
|
@tabs.show
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
#add shell textview
|
|
33
|
+
@shell = VR_TextShell.new(@tabs)
|
|
34
|
+
@builder["scrollShell"].add(@shell)
|
|
34
35
|
@shell.show
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
#add local gem tab
|
|
38
|
+
@gem_tree = VR_Local_Gem_Tree.new(self)
|
|
39
|
+
@builder['scrolledLocalGems'].add(@gem_tree)
|
|
39
40
|
@gem_tree.show
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
#add remote gem tab
|
|
43
|
+
@remote_gem_tree = VR_Remote_Gem_Tree.new(self)
|
|
44
|
+
@builder["scrolledRemoteGems"].add(@remote_gem_tree)
|
|
44
45
|
@remote_gem_tree.show
|
|
45
|
-
|
|
46
|
+
|
|
47
|
+
@splash[:window1].destroy
|
|
48
|
+
Gtk.main_quit
|
|
49
|
+
|
|
46
50
|
unless project_valid?(@proj_path)
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
toolOpenFolder__clicked
|
|
52
|
+
end
|
|
49
53
|
|
|
50
54
|
if project_valid?(@proj_path)
|
|
51
|
-
|
|
55
|
+
load_project
|
|
52
56
|
else
|
|
53
57
|
exit
|
|
54
58
|
end
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
59
|
+
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def project_valid?(proj_path)
|
|
63
|
+
return false if proj_path.nil? or proj_path == ""
|
|
64
|
+
return false if ENV["HOME"] == proj_path
|
|
65
|
+
return false unless File.directory?(proj_path)
|
|
66
|
+
return false unless File.file?(File.join(proj_path, VR_ENV::SETTINGS_FILE))
|
|
67
|
+
return true
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def load_project() # assumes valid_project? is true
|
|
72
|
+
FileUtils.cd(@proj_path)
|
|
73
|
+
@builder['window1'].title = "VR: " + File.basename(Dir.pwd)
|
|
74
|
+
@builder["labelStatus"].label = Dir.pwd
|
|
75
|
+
@file_tree.root = @proj_path
|
|
76
|
+
@file_tree.refresh()
|
|
77
|
+
@shell.buffer.text = ""
|
|
78
|
+
# if default project invalid, set default
|
|
79
|
+
unless project_valid?($VR_ENV_GLOBAL.default_project)
|
|
80
|
+
$VR_ENV_GLOBAL.default_project = @proj_path
|
|
81
|
+
VR::save_yaml($VR_ENV_GLOBAL)
|
|
82
|
+
end
|
|
83
|
+
load_state()
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def toolOpenFolder__clicked(*a)
|
|
87
|
+
save_state
|
|
88
|
+
return unless @tabs.try_to_save_all(:ask=>true)
|
|
89
|
+
old_path = @proj_path
|
|
90
|
+
OpenProject.new(self).show_glade(self)
|
|
91
|
+
if old_path != @proj_path
|
|
92
|
+
@tabs.try_to_save_all(:ask => false, :close => true)
|
|
93
|
+
load_project()
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def notebookTree_changed #file, gem notebook
|
|
98
|
+
case @builder['notebookTree'].page
|
|
99
|
+
when 1 then @gem_tree.refresh()
|
|
100
|
+
when 2 then @remote_gem_tree.refresh(false) #false = don't force refresh
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def window1_key_press(win, key)
|
|
105
|
+
case x = key.keyval
|
|
106
|
+
when 65474 then toolRun__clicked # F5
|
|
107
|
+
# when 115 then toolSave__clicked # Ctrl-S
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def menuCloseAll__activate(*a)
|
|
112
|
+
@tabs.try_to_save_all(:close=>true)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def menuSettings__activate(*a)
|
|
116
|
+
$VR_ENV.show_glade(self)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def menuGlobalSettings__activate(*a)
|
|
120
|
+
$VR_ENV_GLOBAL.show_glade(self)
|
|
121
|
+
@tabs.update_style_all()
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def menuWWWRubygems__activate(*a)
|
|
125
|
+
VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} https://rubygems.org/users/new")
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def menuSaveAll__activate(*a)
|
|
129
|
+
@tabs.try_to_save_all(:ask=>false) # don't prompt
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def menuNew__activate(*a)
|
|
133
|
+
@tabs.load_tab()
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def menuSaveAs__activate(*a)
|
|
137
|
+
@tabs.docs[@tabs.page].save_as()
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def toolRefresh__clicked(*a)
|
|
141
|
+
case @builder['notebookTree'].page
|
|
142
|
+
when 0 then @file_tree.refresh()
|
|
143
|
+
when 1 then @gem_tree.refresh()
|
|
144
|
+
when 2 then @remote_gem_tree.refresh()
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def toolSave__clicked(*a) # saves open tab
|
|
149
|
+
@tabs.docs[@tabs.page].try_to_save(false) # false = don't ask
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def menuNewWindow__activate(*a)
|
|
153
|
+
fn = File.dirname(__FILE__) + "/../../skeleton/document/NewWindow.rb"
|
|
131
154
|
@tabs.load_tab()
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
NewProjectGUI.new(self).show_glade(self)
|
|
161
|
-
if old_path != @proj_path
|
|
162
|
-
@tabs.try_to_save_all(:ask=>false, :close=>true)
|
|
163
|
-
load_project
|
|
164
|
-
end
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
def toolHome__clicked(*a)
|
|
168
|
-
default_project = $VR_ENV_GLOBAL.default_project
|
|
169
|
-
return if default_project == @proj_path
|
|
170
|
-
if not project_valid?(default_project)
|
|
171
|
-
alert("Your default home project is invalid:\n\n<b>#{default_project}</b>.\n\nGo to: Tools > Global Settings to set it.",
|
|
172
|
-
parent: self, headline: "Invalid Home Project")
|
|
173
|
-
return
|
|
174
|
-
end
|
|
175
|
-
return unless @tabs.try_to_save_all( ask: true, close: true)
|
|
176
|
-
@proj_path = default_project
|
|
177
|
-
load_project
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
def toolBackUp__clicked(*a)
|
|
155
|
+
@tabs.set_contents(File.open(fn).read)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def menuNewProject__activate(*a)
|
|
159
|
+
save_state
|
|
160
|
+
return unless @tabs.try_to_save_all(:ask=>true)
|
|
161
|
+
old_path = @proj_path
|
|
162
|
+
NewProjectGUI.new(self).show_glade(self)
|
|
163
|
+
if old_path != @proj_path
|
|
164
|
+
@tabs.try_to_save_all(:ask=>false, :close=>true)
|
|
165
|
+
load_project
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def toolHome__clicked(*a)
|
|
170
|
+
default_project = $VR_ENV_GLOBAL.default_project
|
|
171
|
+
return if default_project == @proj_path
|
|
172
|
+
if not project_valid?(default_project)
|
|
173
|
+
alert("Your default home project is invalid:\n\n<b>#{default_project}</b>.\n\nGo to: Tools > Global Settings to set it.",
|
|
174
|
+
parent: self, headline: "Invalid Home Project")
|
|
175
|
+
return
|
|
176
|
+
end
|
|
177
|
+
return unless @tabs.try_to_save_all( ask: true, close: true)
|
|
178
|
+
@proj_path = default_project
|
|
179
|
+
load_project
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def toolBackUp__clicked(*a)
|
|
181
183
|
return unless @tabs.try_to_save_all(:ask=>true)
|
|
182
|
-
|
|
184
|
+
VR_Tools.back_up()
|
|
183
185
|
end
|
|
184
186
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
+
def toolIndent__clicked(*a)
|
|
188
|
+
@tabs.docs[@tabs.page].indent($VR_ENV_GLOBAL.tab_spaces)
|
|
187
189
|
end
|
|
188
190
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
+
def toolUnIndent__clicked(*a)
|
|
192
|
+
@tabs.docs[@tabs.page].unindent($VR_ENV_GLOBAL.tab_spaces)
|
|
191
193
|
end
|
|
192
194
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
+
def toolComment__clicked(*a)
|
|
196
|
+
@tabs.docs[@tabs.page].comment()
|
|
195
197
|
end
|
|
196
198
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
199
|
+
def toolUnComment__clicked(*a)
|
|
200
|
+
@tabs.docs[@tabs.page].un_comment()
|
|
201
|
+
end
|
|
200
202
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
end
|
|
203
|
+
def toolRun__clicked(*a)
|
|
204
|
+
run_command($VR_ENV.run_command_line)
|
|
205
|
+
end
|
|
204
206
|
|
|
205
|
-
|
|
207
|
+
def run_command(cmd)
|
|
206
208
|
save_state()
|
|
207
209
|
return unless @tabs.try_to_save_all(:ask => false) # false = don't prompt for changes to files
|
|
208
|
-
|
|
210
|
+
cur_dir = Dir.pwd
|
|
209
211
|
result = "\n#{cur_dir}$ #{cmd}\n"
|
|
210
212
|
result += `#{cmd} 2>&1`
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
213
|
+
FileUtils.cd(cur_dir)
|
|
214
|
+
@shell.hilight_links(result, true)
|
|
215
|
+
end
|
|
214
216
|
|
|
215
217
|
def save_state
|
|
216
|
-
|
|
218
|
+
return unless $VR_ENV
|
|
217
219
|
$VR_ENV.width, $VR_ENV.height = @builder["window1"].size()
|
|
218
220
|
$VR_ENV.panel_pos = @builder["panelMain"].position
|
|
219
221
|
$VR_ENV.notebook_panel_position = @builder["panelNotebook"].position
|
|
220
222
|
$VR_ENV.open_folders = @file_tree.get_open_folders()
|
|
221
223
|
$VR_ENV.open_files = @tabs.get_open_fn()
|
|
222
224
|
$VR_ENV.current_file = @tabs.docs[@tabs.page].full_path_file
|
|
223
|
-
|
|
225
|
+
$VR_ENV.current_line = @tabs.docs[@tabs.page].line_at_cursor()
|
|
224
226
|
VR::save_yaml($VR_ENV)
|
|
225
227
|
end
|
|
226
228
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
+
def load_state
|
|
230
|
+
$VR_ENV = VR::load_yaml(:class => VR_ENV, :file_name => VR_ENV::SETTINGS_FILE)
|
|
229
231
|
@builder["window1"].resize($VR_ENV.width, $VR_ENV.height)
|
|
230
232
|
@builder['panelMain'].set_position($VR_ENV.panel_pos)
|
|
231
|
-
|
|
233
|
+
@builder["panelNotebook"].set_position($VR_ENV.notebook_panel_position)
|
|
232
234
|
@tabs.open_file_names($VR_ENV.open_files)
|
|
233
235
|
@file_tree.open_folders($VR_ENV.open_folders)
|
|
234
236
|
@tabs.load_tab($VR_ENV.current_file)
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
end
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
237
|
+
@tabs.docs[@tabs.page].jump_to_line($VR_ENV.current_line)
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
def menuCreateGemspec__activate(*a)
|
|
241
|
+
if file_name = VR_Tools.create_gemspec()
|
|
242
|
+
@tabs.destroy_file_tab(file_name)
|
|
243
|
+
@tabs.load_tab(file_name)
|
|
244
|
+
@file_tree.refresh()
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
def buttonNext_clicked
|
|
249
|
+
@shell.jump_to()
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
def buttonFind_clicked
|
|
253
|
+
str = @builder["entryFind"].text
|
|
254
|
+
str = str.length < 2 ? @tabs.docs[@tabs.page].selected_text() : str
|
|
255
|
+
return if str.length < 2
|
|
256
|
+
text = (@builder["radioOnDisk"].active?) ? @tabs.find_in_all(str) : @tabs.find_in_tabs(str)
|
|
257
|
+
@shell.hilight_links(text, false)
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
def buttonReplace_clicked
|
|
261
|
+
@tabs.docs[@tabs.page].replace(@builder[:entryReplace].text)
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
def entryFind_key_press(me, evt)
|
|
265
|
+
return if evt.keyval != 65293 #enter key
|
|
266
|
+
buttonFind_clicked
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
def menuTutorials__activate(*a)
|
|
270
|
+
VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} http://www.visualruby.net")
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
def menuInstallExamples__activate(*a)
|
|
274
|
+
path = File.join(ENV["HOME"], "", "visualruby", "examples")
|
|
275
|
+
VR_Tools.copy_recursively(File.expand_path(File.join(File.dirname(__FILE__),"","..","..","examples")), path)
|
|
276
|
+
alert("The example projects are installed in this folder:\n\n<b>#{path}</b>\n\n "+
|
|
277
|
+
"Use your <b>/home/visualruby</b> folder for all your visualruby projects.",
|
|
278
|
+
:parent => self,
|
|
279
|
+
:headline => "Installing Example Projects...",
|
|
280
|
+
:width => 500)
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
# needed so tabs can be saved, called before destroy, must return false to close wndow.
|
|
282
284
|
def window1__delete_event(*args)
|
|
283
|
-
|
|
285
|
+
save_state
|
|
284
286
|
return true unless @tabs.try_to_save_all(:ask=>true)
|
|
285
287
|
return false #ok to close
|
|
286
288
|
end
|
|
287
289
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
290
|
+
def menuQuit__activate(*a)
|
|
291
|
+
@builder[:window1].destroy
|
|
292
|
+
end
|
|
291
293
|
|
|
292
294
|
end
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
class VR_Remote_Gem_Tree < GemTree
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
include GladeGUI
|
|
4
|
+
|
|
5
|
+
def initialize(main)
|
|
6
|
+
super()
|
|
7
|
+
@main = main
|
|
8
|
+
@gems = Hash.new
|
|
9
|
+
load_glade() #for pop-up menu
|
|
10
|
+
parse_signals()
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def refresh(force = true)
|
|
14
|
+
return if @t
|
|
15
|
+
return unless force or not self.model.iter_first
|
|
16
|
+
return unless @api.get_key()
|
|
17
|
+
@t = Thread.new do
|
|
18
18
|
@main.shell.buffer.text += "\nContacting rubygems.org..."
|
|
19
19
|
self.model.clear
|
|
20
20
|
return unless @gems = @api.get_obj_url("/api/v1/gems.yaml")
|
|
@@ -22,34 +22,34 @@ class VR_Remote_Gem_Tree < GemTree
|
|
|
22
22
|
gem_info = @api.get_obj_url("/api/v1/versions/#{gem['name']}.yaml")
|
|
23
23
|
gem_info.each do |info|
|
|
24
24
|
self.add_row(:pix => RUBY_ICON, :gem => "#{gem['name']} (#{info['number']})")
|
|
25
|
-
|
|
25
|
+
end
|
|
26
26
|
end
|
|
27
27
|
@t.join
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
28
|
+
end
|
|
29
|
+
@t = false
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def selected_gem
|
|
33
|
+
row = self.selection.selected[1].split(" (")
|
|
34
|
+
@gems.detect { |gem| gem['name'] == row[0] } #and gem['version'] == ver}
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def popOpenRubygemsPage__activate(*args)
|
|
38
|
+
gem = selected_gem()
|
|
39
|
+
VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} #{gem['project_uri']}")
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def popOpenHomepage__activate(*args)
|
|
43
|
+
gem = selected_gem()
|
|
44
|
+
VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} #{gem['homepage_uri']}")
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def popYank__activate(*args)
|
|
48
|
+
name, ver = get_name_ver(selection.selected[1])
|
|
49
|
+
reply = @api.yank_gem(name, ver)
|
|
50
|
+
@main.shell.buffer.text = "Yanking gem: #{name} #{ver}\n" + reply
|
|
51
|
+
self.model.remove(selection.selected) if reply.include? "OK"
|
|
52
|
+
end
|
|
53
53
|
|
|
54
54
|
end
|
|
55
55
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!-- Generated with glade 3.16.1 -->
|
|
3
|
+
<interface>
|
|
4
|
+
<requires lib="gtk+" version="3.0"/>
|
|
5
|
+
<object class="GtkWindow" id="window1">
|
|
6
|
+
<property name="can_focus">False</property>
|
|
7
|
+
<property name="modal">True</property>
|
|
8
|
+
<property name="window_position">center</property>
|
|
9
|
+
<property name="type_hint">splashscreen</property>
|
|
10
|
+
<property name="decorated">False</property>
|
|
11
|
+
<child>
|
|
12
|
+
<object class="GtkImage" id="image1">
|
|
13
|
+
<property name="visible">True</property>
|
|
14
|
+
<property name="can_focus">False</property>
|
|
15
|
+
<property name="stock">gtk-missing-image</property>
|
|
16
|
+
</object>
|
|
17
|
+
</child>
|
|
18
|
+
</object>
|
|
19
|
+
</interface>
|