visualruby 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/.vr_settings.yaml +27 -0
  3. data/bin/editor/VR_Document.rb +156 -156
  4. data/bin/editor/VR_TabSearch.rb +37 -37
  5. data/bin/editor/VR_Tabs.rb +82 -82
  6. data/bin/editor/VR_TextShell.rb +49 -52
  7. data/bin/editor/VR_TextViewCommon.rb +31 -31
  8. data/bin/main/GemTree.rb +14 -14
  9. data/bin/main/NewProjectGUI.rb +24 -24
  10. data/bin/main/OpenProject.rb +53 -53
  11. data/bin/main/ProjectChooserView.rb +31 -31
  12. data/bin/main/ProjectTree.rb +17 -17
  13. data/bin/main/RubygemsAPI.rb +73 -63
  14. data/bin/main/VR_ENV.rb +29 -29
  15. data/bin/main/VR_ENV_GLOBAL.rb +52 -52
  16. data/bin/main/VR_File_Tree.rb +88 -88
  17. data/bin/main/VR_Local_Gem_Tree.rb +53 -53
  18. data/bin/main/VR_Main.rb +240 -238
  19. data/bin/main/VR_Remote_Gem_Tree.rb +41 -41
  20. data/bin/main/glade/Splash.glade +19 -0
  21. data/bin/tools/VR_Tools.rb +72 -72
  22. data/examples/active_record/.vr_settings.yaml +50 -0
  23. data/examples/active_record/active_record.rb +2 -2
  24. data/examples/active_record/bin/ChoosePerson.rb +10 -10
  25. data/examples/active_record/bin/Person.rb +6 -6
  26. data/examples/active_record2/.vr_settings.yaml +23 -0
  27. data/examples/active_record2/bin/CompanyGUI.rb +42 -42
  28. data/examples/active_record2/bin/Employee.rb +13 -13
  29. data/examples/active_record2/bin/Employer.rb +5 -5
  30. data/examples/active_record2/bin/Paycheck.rb +5 -5
  31. data/examples/active_record2/main.rb +4 -4
  32. data/examples/alert_box/bin/AlertBoxDemo.rb +40 -50
  33. data/examples/alert_box/bin/glade/AlertBoxDemo.glade +14 -45
  34. data/examples/all_widgets/.vr_settings.yaml +18 -0
  35. data/examples/all_widgets/bin/AllWidgets.rb +19 -16
  36. data/examples/calculator/.vr_settings.yaml +18 -0
  37. data/examples/calculator/bin/Calculator.rb +22 -22
  38. data/examples/child_window/.vr_settings.yaml +21 -0
  39. data/examples/child_window/bin/ChildWindowDemo.rb +10 -10
  40. data/examples/child_window/bin/ModalWindow.rb +4 -4
  41. data/examples/child_window/bin/ModelessWindow.rb +4 -4
  42. data/examples/child_window/bin/MyChildClass.rb +10 -10
  43. data/examples/drag_drop/.vr_settings.yaml +16 -0
  44. data/examples/drag_drop/bin/DragDropDemo.rb +28 -28
  45. data/examples/filetreeview/.vr_settings.yaml +20 -0
  46. data/examples/filetreeview/bin/ProjectTree.rb +13 -23
  47. data/examples/filetreeview/bin/ProjectTreeGUI.rb +18 -17
  48. data/examples/listview/.vr_settings.yaml +19 -0
  49. data/examples/listview/bin/SongListView.rb +72 -72
  50. data/examples/listview/bin/SongListViewGUI.rb +52 -52
  51. data/examples/listview_objects/.vr_settings.yaml +19 -0
  52. data/examples/listview_objects/bin/DataObject.rb +23 -23
  53. data/examples/listview_objects/bin/ListViewObjects.rb +29 -29
  54. data/examples/listview_objects/bin/ListViewObjectsGUI.rb +12 -12
  55. data/examples/settings_file/bin/MainApp.rb +25 -25
  56. data/examples/settings_file/bin/SavableSettings.rb +25 -26
  57. data/examples/settings_file/settings.yaml +1 -1
  58. data/examples/simple_ruby_gui/.vr_settings.yaml +20 -0
  59. data/examples/simple_ruby_gui/bin/DataObjectGUI.rb +12 -12
  60. data/examples/treeview/.vr_settings.yaml +17 -0
  61. data/examples/treeview/bin/MyClass.rb +18 -17
  62. data/examples/treeview/bin/glade/MyClass.glade +61 -6
  63. data/skeleton/document/NewWindow.rb +8 -8
  64. data/skeleton/project/.vr_settings.yaml +15 -0
  65. data/skeleton/project/bin/MyClass.rb +7 -7
  66. data/vr +38 -41
  67. data/vrlib/doc/images/add.png +0 -0
  68. data/vrlib/doc/images/arrow_up.png +0 -0
  69. data/vrlib/doc/images/brick.png +0 -0
  70. data/vrlib/doc/images/brick_link.png +0 -0
  71. data/vrlib/doc/images/bug.png +0 -0
  72. data/vrlib/doc/images/bullet_black.png +0 -0
  73. data/vrlib/doc/images/bullet_toggle_minus.png +0 -0
  74. data/vrlib/doc/images/bullet_toggle_plus.png +0 -0
  75. data/vrlib/doc/images/date.png +0 -0
  76. data/vrlib/doc/images/delete.png +0 -0
  77. data/vrlib/doc/images/find.png +0 -0
  78. data/vrlib/doc/images/macFFBgHack.png +0 -0
  79. data/vrlib/doc/images/package.png +0 -0
  80. data/vrlib/doc/images/page_green.png +0 -0
  81. data/vrlib/doc/images/page_white_text.png +0 -0
  82. data/vrlib/doc/images/page_white_width.png +0 -0
  83. data/vrlib/doc/images/plugin.png +0 -0
  84. data/vrlib/doc/images/ruby.png +0 -0
  85. data/vrlib/doc/images/tag_blue.png +0 -0
  86. data/vrlib/doc/images/tag_green.png +0 -0
  87. data/vrlib/doc/images/transparent.png +0 -0
  88. data/vrlib/doc/images/wrench.png +0 -0
  89. data/vrlib/doc/images/wrench_orange.png +0 -0
  90. data/vrlib/doc/images/zoom.png +0 -0
  91. data/vrlib/lib/Alert.rb +98 -55
  92. data/vrlib/lib/DragDrop.rb +43 -43
  93. data/vrlib/lib/GladeGUI.rb +207 -207
  94. data/vrlib/lib/IconHash.rb +10 -10
  95. data/vrlib/lib/SavableClass.rb +38 -38
  96. data/vrlib/lib/SimpleComboBoxEntry.rb +3 -3
  97. data/vrlib/lib/treeview/FileTreeView.rb +71 -70
  98. data/vrlib/lib/treeview/IterMethods.rb +35 -35
  99. data/vrlib/lib/treeview/ListView.rb +25 -25
  100. data/vrlib/lib/treeview/TreeView.rb +15 -15
  101. data/vrlib/lib/treeview/ViewCommon.rb +134 -131
  102. data/vrlib/lib/treeview/columns/CalendarCol.rb +48 -48
  103. data/vrlib/lib/treeview/columns/CellRendererCombo.rb +26 -26
  104. data/vrlib/lib/treeview/columns/CellRendererDate.rb +25 -25
  105. data/vrlib/lib/treeview/columns/CellRendererObject.rb +37 -37
  106. data/vrlib/lib/treeview/columns/CellRendererPhone.rb +25 -25
  107. data/vrlib/lib/treeview/columns/CellRendererPixbuf.rb +8 -8
  108. data/vrlib/lib/treeview/columns/CellRendererProgress.rb +8 -8
  109. data/vrlib/lib/treeview/columns/CellRendererSpin.rb +17 -17
  110. data/vrlib/lib/treeview/columns/CellRendererText.rb +18 -18
  111. data/vrlib/lib/treeview/columns/CellRendererToggle.rb +25 -25
  112. data/vrlib/lib/treeview/columns/ComboCol.rb +12 -12
  113. data/vrlib/lib/treeview/columns/CurrencyCol.rb +13 -13
  114. data/vrlib/lib/treeview/columns/DateCol.rb +10 -10
  115. data/vrlib/lib/treeview/columns/ImageCol.rb +16 -16
  116. data/vrlib/lib/treeview/columns/SpinCol.rb +5 -5
  117. data/vrlib/lib/treeview/columns/TextCol.rb +24 -24
  118. data/vrlib/lib/treeview/columns/TreeViewColumn.rb +71 -76
  119. data/vrlib/rdoc_replace.yaml +36 -36
  120. metadata +43 -6
  121. data/Splash.rb +0 -40
data/bin/main/VR_Main.rb CHANGED
@@ -1,292 +1,294 @@
1
1
  class VR_Main
2
2
 
3
- include GladeGUI
4
-
5
- attr_accessor :proj_path, :tabs, :shell, :builder, :file_tree
6
-
7
- def initialize(argv)
8
- @proj_path = argv[0] ? argv[0] : Dir.pwd
9
- @proj_path = @proj_path.chomp("/")
10
- end
11
-
12
- def before_show
13
- # there must be a visualruby directory:
14
- menuInstallExamples__activate if not File.directory?(File.join(ENV["HOME"],"","visualruby", "examples","drag_drop"))
15
- # load global settings (requires /home/visuaruby folder exists
16
- $VR_ENV_GLOBAL = VR::load_yaml(:class => VR_ENV_GLOBAL, :file_name => VR_ENV_GLOBAL::GLOBAL_SETTINGS_FILE)
17
- # try to open right project
18
-
19
- if not project_valid?(@proj_path)
20
- @proj_path = $VR_ENV_GLOBAL.default_project if project_valid?($VR_ENV_GLOBAL.default_project)
21
- end
22
-
23
- @file_tree = VR_File_Tree.new(self, File.expand_path(File.dirname(__FILE__) + "/../../img"))
24
- @builder["scrolledwindowFileTree"].add(@file_tree)
25
-
26
- #add document notebook
27
- @tabs = VR_Tabs.new(self)
28
- @builder["boxTabs"].add(@tabs)
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
- #add shell textview
32
- @shell = VR_TextShell.new(@tabs)
33
- @builder["scrollShell"].add(@shell)
32
+ #add shell textview
33
+ @shell = VR_TextShell.new(@tabs)
34
+ @builder["scrollShell"].add(@shell)
34
35
  @shell.show
35
36
 
36
- #add local gem tab
37
- @gem_tree = VR_Local_Gem_Tree.new(self)
38
- @builder['scrolledLocalGems'].add(@gem_tree)
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
- #add remote gem tab
42
- @remote_gem_tree = VR_Remote_Gem_Tree.new(self)
43
- @builder["scrolledRemoteGems"].add(@remote_gem_tree)
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
- toolOpenFolder__clicked
48
- end
51
+ toolOpenFolder__clicked
52
+ end
49
53
 
50
54
  if project_valid?(@proj_path)
51
- load_project
55
+ load_project
52
56
  else
53
57
  exit
54
58
  end
55
- $splash.destroy if $splash
56
- Gtk.main_quit
57
-
58
- end
59
-
60
- def project_valid?(proj_path)
61
- return false if proj_path.nil? or proj_path == ""
62
- return false if ENV["HOME"] == proj_path
63
- return false unless File.directory?(proj_path)
64
- return false unless File.file?(File.join(proj_path, VR_ENV::SETTINGS_FILE))
65
- return true
66
- end
67
-
68
-
69
- def load_project() # 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
- @file_tree.root = @proj_path
74
- @file_tree.refresh()
75
- @shell.buffer.text = ""
76
- # if default project invalid, set default
77
- unless project_valid?($VR_ENV_GLOBAL.default_project)
78
- $VR_ENV_GLOBAL.default_project = @proj_path
79
- VR::save_yaml($VR_ENV_GLOBAL)
80
- end
81
- load_state()
82
- end
83
-
84
- def toolOpenFolder__clicked(*a)
85
- save_state
86
- return unless @tabs.try_to_save_all(:ask=>true)
87
- old_path = @proj_path
88
- OpenProject.new(self).show_glade(self)
89
- if old_path != @proj_path
90
- @tabs.try_to_save_all(:ask => false, :close => true)
91
- load_project()
92
- end
93
- end
94
-
95
- def notebookTree_changed #file, gem notebook
96
- case @builder['notebookTree'].page
97
- when 1 then @gem_tree.refresh()
98
- when 2 then @remote_gem_tree.refresh(false) #false = don't force refresh
99
- end
100
- end
101
-
102
- def window1_key_press(win, key)
103
- case x = key.keyval
104
- when 65474 then toolRun__clicked # F5
105
- # when 115 then toolSave__clicked # Ctrl-S
106
- end
107
- end
108
-
109
- def menuCloseAll__activate(*a)
110
- @tabs.try_to_save_all(:close=>true)
111
- end
112
-
113
- def menuSettings__activate(*a)
114
- $VR_ENV.show_glade(self)
115
- end
116
-
117
- def menuGlobalSettings__activate(*a)
118
- $VR_ENV_GLOBAL.show_glade(self)
119
- @tabs.update_style_all()
120
- end
121
-
122
- def menuWWWRubygems__activate(*a)
123
- VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} https://rubygems.org/users/new")
124
- end
125
-
126
- def menuSaveAll__activate(*a)
127
- @tabs.try_to_save_all(:ask=>false) # don't prompt
128
- end
129
-
130
- def menuNew__activate(*a)
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
- end
133
-
134
- def menuSaveAs__activate(*a)
135
- @tabs.docs[@tabs.page].save_as()
136
- end
137
-
138
- def toolRefresh__clicked(*a)
139
- case @builder['notebookTree'].page
140
- when 0 then @file_tree.refresh()
141
- when 1 then @gem_tree.refresh()
142
- when 2 then @remote_gem_tree.refresh()
143
- end
144
- end
145
-
146
- def toolSave__clicked(*a) # saves open tab
147
- @tabs.docs[@tabs.page].try_to_save(false) # false = don't ask
148
- end
149
-
150
- def menuNewWindow__activate(*a)
151
- fn = File.dirname(__FILE__) + "/../../skeleton/document/NewWindow.rb"
152
- @tabs.load_tab()
153
- @tabs.set_contents(File.open(fn).read)
154
- end
155
-
156
- def menuNewProject__activate(*a)
157
- save_state
158
- return unless @tabs.try_to_save_all(:ask=>true)
159
- old_path = @proj_path
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
- VR_Tools.back_up()
184
+ VR_Tools.back_up()
183
185
  end
184
186
 
185
- def toolIndent__clicked(*a)
186
- @tabs.docs[@tabs.page].indent($VR_ENV_GLOBAL.tab_spaces)
187
+ def toolIndent__clicked(*a)
188
+ @tabs.docs[@tabs.page].indent($VR_ENV_GLOBAL.tab_spaces)
187
189
  end
188
190
 
189
- def toolUnIndent__clicked(*a)
190
- @tabs.docs[@tabs.page].unindent($VR_ENV_GLOBAL.tab_spaces)
191
+ def toolUnIndent__clicked(*a)
192
+ @tabs.docs[@tabs.page].unindent($VR_ENV_GLOBAL.tab_spaces)
191
193
  end
192
194
 
193
- def toolComment__clicked(*a)
194
- @tabs.docs[@tabs.page].comment()
195
+ def toolComment__clicked(*a)
196
+ @tabs.docs[@tabs.page].comment()
195
197
  end
196
198
 
197
- def toolUnComment__clicked(*a)
198
- @tabs.docs[@tabs.page].un_comment()
199
- end
199
+ def toolUnComment__clicked(*a)
200
+ @tabs.docs[@tabs.page].un_comment()
201
+ end
200
202
 
201
- def toolRun__clicked(*a)
202
- run_command($VR_ENV.run_command_line)
203
- end
203
+ def toolRun__clicked(*a)
204
+ run_command($VR_ENV.run_command_line)
205
+ end
204
206
 
205
- def run_command(cmd)
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
- cur_dir = Dir.pwd
210
+ cur_dir = Dir.pwd
209
211
  result = "\n#{cur_dir}$ #{cmd}\n"
210
212
  result += `#{cmd} 2>&1`
211
- FileUtils.cd(cur_dir)
212
- @shell.hilight_links(result, true)
213
- end
213
+ FileUtils.cd(cur_dir)
214
+ @shell.hilight_links(result, true)
215
+ end
214
216
 
215
217
  def save_state
216
- return unless $VR_ENV
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
- $VR_ENV.current_line = @tabs.docs[@tabs.page].line_at_cursor()
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
- def load_state
228
- $VR_ENV = VR::load_yaml(:class => VR_ENV, :file_name => VR_ENV::SETTINGS_FILE)
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
- @builder["panelNotebook"].set_position($VR_ENV.notebook_panel_position)
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
- @tabs.docs[@tabs.page].jump_to_line($VR_ENV.current_line)
236
- end
237
-
238
- def menuCreateGemspec__activate(*a)
239
- if file_name = VR_Tools.create_gemspec()
240
- @tabs.destroy_file_tab(file_name)
241
- @tabs.load_tab(file_name)
242
- @file_tree.refresh()
243
- end
244
- end
245
-
246
- def buttonNext_clicked
247
- @shell.jump_to()
248
- end
249
-
250
- def buttonFind_clicked
251
- str = @builder["entryFind"].text
252
- str = str.length < 2 ? @tabs.docs[@tabs.page].selected_text() : str
253
- return if str.length < 2
254
- text = (@builder["radioOnDisk"].active?) ? @tabs.find_in_all(str) : @tabs.find_in_tabs(str)
255
- @shell.hilight_links(text, false)
256
- end
257
-
258
- def buttonReplace_clicked
259
- @tabs.docs[@tabs.page].replace(@builder[:entryReplace].text)
260
- end
261
-
262
- def entryFind_key_press(me, evt)
263
- return if evt.keyval != 65293 #enter key
264
- buttonFind_clicked
265
- end
266
-
267
- def menuTutorials__activate(*a)
268
- VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} http://www.visualruby.net")
269
- end
270
-
271
- def menuInstallExamples__activate(*a)
272
- path = File.join(ENV["HOME"], "", "visualruby", "examples")
273
- VR_Tools.copy_recursively(File.expand_path(File.join(File.dirname(__FILE__),"","..","..","examples")), path)
274
- alert("The example projects are installed in this folder:\n\n<b>#{path}</b>\n\n "+
275
- "Use your <b>/home/visualruby</b> folder for all your visualruby projects.",
276
- :parent => self,
277
- :headline => "Installing Example Projects...",
278
- :width => 500)
279
- end
280
-
281
- # needed so tabs can be saved, called before destroy, must return false to close wndow.
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
- save_state
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
- def menuQuit__activate(*a)
289
- @builder[:window1].destroy
290
- end
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
- 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
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
- end
25
+ end
26
26
  end
27
27
  @t.join
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
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>