ruber 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/CHANGES +21 -0
  2. data/data/share/apps/ruber/ruberui.rc +3 -1
  3. data/lib/ruber/application/application.rb +22 -23
  4. data/lib/ruber/application/plugin.yaml +7 -2
  5. data/lib/ruber/{projects → application}/project_files_list.rb +0 -0
  6. data/lib/ruber/{projects → application}/project_files_widget.rb +0 -0
  7. data/lib/ruber/application/ui/project_files_rule_chooser_widget.rb +74 -0
  8. data/lib/ruber/{projects → application}/ui/project_files_rule_chooser_widget.ui +0 -0
  9. data/lib/ruber/application/ui/project_files_widget.rb +117 -0
  10. data/lib/ruber/{projects → application}/ui/project_files_widget.ui +0 -0
  11. data/lib/ruber/component_manager.rb +14 -9
  12. data/lib/ruber/editor/document.rb +35 -5
  13. data/lib/ruber/kde_sugar.rb +16 -0
  14. data/lib/ruber/main_window/choose_plugins_dlg.rb +7 -4
  15. data/lib/ruber/main_window/main_window.rb +131 -193
  16. data/lib/ruber/main_window/main_window_actions.rb +157 -58
  17. data/lib/ruber/main_window/main_window_internal.rb +145 -54
  18. data/lib/ruber/main_window/open_file_in_project_dlg.rb +4 -4
  19. data/lib/ruber/main_window/plugin.yaml +3 -6
  20. data/lib/ruber/main_window/ui/workspace_settings_widget.rb +2 -2
  21. data/lib/ruber/main_window/workspace.rb +62 -32
  22. data/lib/ruber/output_widget.rb +20 -16
  23. data/lib/ruber/pane.rb +11 -5
  24. data/lib/ruber/project.rb +27 -12
  25. data/lib/ruber/projects/ui/project_files_rule_chooser_widget.rb +2 -2
  26. data/lib/ruber/projects/ui/project_files_widget.rb +2 -2
  27. data/lib/ruber/utils.rb +37 -4
  28. data/lib/ruber/version.rb +1 -1
  29. data/lib/ruber/world/document_factory.rb +121 -0
  30. data/lib/ruber/world/document_list.rb +396 -0
  31. data/lib/ruber/world/environment.rb +470 -0
  32. data/lib/ruber/{main_window → world}/hint_solver.rb +1 -1
  33. data/lib/ruber/world/plugin.yaml +11 -0
  34. data/lib/ruber/world/project_factory.rb +131 -0
  35. data/lib/ruber/world/project_list.rb +265 -0
  36. data/lib/ruber/world/ui/workspace_settings_widget.rb +51 -0
  37. data/lib/ruber/{main_window → world}/ui/workspace_settings_widget.ui +0 -0
  38. data/lib/ruber/world/world.rb +307 -0
  39. data/plugins/auto_end/auto_end.rb +135 -9
  40. data/plugins/autosave/autosave.rb +4 -4
  41. data/plugins/find_in_files/find_in_files.rb +5 -5
  42. data/plugins/find_in_files/find_in_files_widgets.rb +1 -1
  43. data/plugins/project_browser/project_browser.rb +4 -4
  44. data/plugins/rake/rake.rb +4 -4
  45. data/plugins/rake/rake_extension.rb +1 -1
  46. data/plugins/rspec/rspec.rb +4 -4
  47. data/plugins/rspec/ruber_rspec_formatter.rb +2 -2
  48. data/plugins/ruby_development/ruby_development.rb +3 -3
  49. data/plugins/ruby_runner/ruby_runner.rb +2 -2
  50. data/plugins/state/plugin.yaml +6 -8
  51. data/plugins/state/state.rb +201 -391
  52. data/plugins/state/ui/config_widget.rb +5 -5
  53. data/plugins/state/ui/config_widget.ui +3 -3
  54. data/plugins/syntax_checker/syntax_checker.rb +4 -0
  55. data/spec/annotation_model_spec.rb +1 -1
  56. data/spec/auto_end_spec.rb +98 -47
  57. data/spec/component_manager_spec.rb +80 -21
  58. data/spec/document_factory_spec.rb +115 -0
  59. data/spec/document_list_spec.rb +560 -450
  60. data/spec/document_spec.rb +143 -55
  61. data/spec/editor_view_spec.rb +2 -2
  62. data/spec/environment_spec.rb +1900 -0
  63. data/spec/hint_solver_spec.rb +5 -5
  64. data/spec/kde_sugar_spec.rb +16 -0
  65. data/spec/output_widget_spec.rb +177 -51
  66. data/spec/pane_spec.rb +29 -5
  67. data/spec/plugin_spec.rb +1 -1
  68. data/spec/project_factory_spec.rb +104 -0
  69. data/spec/project_list_spec.rb +352 -447
  70. data/spec/project_spec.rb +34 -33
  71. data/spec/qt_sugar_spec.rb +2 -2
  72. data/spec/state_spec.rb +508 -811
  73. data/spec/utils_spec.rb +149 -98
  74. data/spec/workspace_spec.rb +120 -9
  75. data/spec/world_spec.rb +1219 -0
  76. metadata +23 -14
  77. data/lib/ruber/documents/document_list.rb +0 -412
  78. data/lib/ruber/documents/plugin.yaml +0 -4
  79. data/lib/ruber/main_window/view_manager.rb +0 -431
  80. data/lib/ruber/projects/plugin.yaml +0 -11
  81. data/lib/ruber/projects/project_list.rb +0 -314
@@ -74,6 +74,22 @@ return *true* for both absolute and relative paths.
74
74
  !(local_file? or relative?)
75
75
  end
76
76
 
77
+ =begin rdoc
78
+ @return [Boolean] *true* if the two URLs are equal according to @==@ and *false*
79
+ otherwise
80
+ =end
81
+ def eql? other
82
+ self == other
83
+ end
84
+
85
+ =begin rdoc
86
+ Override of Object#hash
87
+ @return [Integer] the hash value of the path associated with the URL
88
+ =end
89
+ def hash
90
+ path.hash
91
+ end
92
+
77
93
  end
78
94
 
79
95
  class TabWidget
@@ -144,9 +144,9 @@ deselected.
144
144
 
145
145
  connect m, SIGNAL('itemChanged(QStandardItem*)'), self, SLOT('plugin_toggled(QStandardItem*)')
146
146
 
147
- def m.flags idx
148
- Qt::ItemIsSelectable|Qt::ItemIsEnabled| Qt::ItemIsUserCheckable
149
- end
147
+ # def m.flags idx
148
+ # Qt::ItemIsSelectable|Qt::ItemIsEnabled| Qt::ItemIsUserCheckable
149
+ # end
150
150
 
151
151
  @url = KDE::UrlRequester.new self
152
152
  @ui.directories.custom_editor = @url.custom_editor
@@ -276,7 +276,10 @@ size of the contents.
276
276
  name.data = Qt::Variant.new(k.to_s)
277
277
  desc = Qt::StandardItem.new v.about.description
278
278
  dir = Qt::StandardItem.new v.directory
279
- m.append_row [name, desc, dir]
279
+ row = [name, desc, dir]
280
+ row.each{|i| i.flags = Qt::ItemIsSelectable|Qt::ItemIsEnabled}
281
+ name.flags |= Qt::ItemIsUserCheckable
282
+ m.append_row row
280
283
  end
281
284
  update_plugin_status
282
285
  3.times{|i| @ui.plugins.resize_column_to_contents i}
@@ -29,8 +29,6 @@ require 'ruber/gui_states_handler'
29
29
 
30
30
  require 'ruber/main_window/main_window_internal'
31
31
  require 'ruber/main_window/main_window_actions'
32
- require 'ruber/main_window/hint_solver'
33
- require 'ruber/main_window/view_manager'
34
32
 
35
33
  require 'ruber/main_window/status_bar'
36
34
  require 'ruber/main_window/workspace'
@@ -43,6 +41,9 @@ The application's main window. It is made of a menu bar, a tool bar, a workspace
43
41
  and a status bar. The workspace (see Workspace) is the main window's central widget
44
42
  and where most of the user interaction happens. It contains the editors and the
45
43
  tool widgets.
44
+
45
+ @api feature main_window
46
+ @extension environment {api: '{Environment}'}
46
47
  =end
47
48
  class MainWindow < KParts::MainWindow
48
49
 
@@ -56,17 +57,7 @@ tool widgets.
56
57
 
57
58
  slots :load_settings
58
59
 
59
- =begin rdoc
60
- The default hints used by methods like {#editor_for} and {#editor_for!}
61
- =end
62
- DEFAULT_HINTS = {
63
- :exisiting => :always,
64
- :strategy => [:current, :current_tab, :first],
65
- :new => :new_tab,
66
- :split => :horizontal,
67
- :show => true,
68
- :create_if_needed => true
69
- }.freeze
60
+ DEFAULT_HINTS = Ruber::World::Environment::DEFAULT_HINTS
70
61
 
71
62
  =begin rdoc
72
63
  The widget which contains the tool widgets.
@@ -98,17 +89,15 @@ is the plugin description for this object.
98
89
  super nil, 0
99
90
  initialize_plugin pdf
100
91
  initialize_states_handler
101
- self.central_widget = Workspace.new self
102
- # We need the instance variable to use it with Forwardable
103
- @workspace = central_widget
104
- @tabs = central_widget.instance_variable_get :@views
105
- @tabs.tabs_closable = Ruber[:config][:workspace, :close_buttons]
106
- @view_manager = ViewManager.new @tabs, self
107
- @auto_activate_editors = true
92
+ @active_environment = nil
93
+ @workspace = Workspace.new self
94
+ self.central_widget = @workspace
95
+ @workspace.add_widget Ruber[:world].default_environment.tab_widget
108
96
  @ui_states = {}
109
97
  @actions_state_handlers = Hash.new{|h, k| h[k] = []}
110
98
  @about_plugin_actions = []
111
99
  @switch_to_actions = []
100
+ @activate_project_actions = []
112
101
  @last_session_data = nil
113
102
  self.status_bar = StatusBar.new self
114
103
  self.connect(SIGNAL('current_document_changed(QObject*)')) do |doc|
@@ -117,17 +106,20 @@ is the plugin description for this object.
117
106
  connect Ruber[:components], SIGNAL('component_loaded(QObject*)'), self, SLOT('add_about_plugin_action(QObject*)')
118
107
  connect Ruber[:components], SIGNAL('unloading_component(QObject*)'), self, SLOT('remove_about_plugin_action(QObject*)')
119
108
  connect Ruber[:components], SIGNAL('unloading_component(QObject*)'), self, SLOT('remove_plugin_ui_actions(QObject*)')
120
- connect @view_manager, SIGNAL('active_editor_changed(QWidget*)'), self, SLOT('slot_active_editor_changed(QWidget*)')
121
- connect Ruber[:documents], SIGNAL('document_created(QObject*)'), self, SLOT('document_created(QObject*)')
122
- connect Ruber[:documents], SIGNAL('closing_document(QObject*)'), self, SLOT(:update_switch_to_list)
109
+ connect Ruber[:world], SIGNAL('active_environment_changed_2(QObject*, QObject*)'), self, SLOT('slot_active_environment_changed(QObject*, QObject*)')
110
+ connect Ruber[:world], SIGNAL('document_created(QObject*)'), self, SLOT('document_created(QObject*)')
111
+ connect Ruber[:world], SIGNAL('closing_document(QObject*)'), self, SLOT(:update_switch_to_list)
123
112
 
124
113
  setup_actions action_collection
125
- Ruber[:projects].connect( SIGNAL('current_project_changed(QObject*)') ) do |prj|
126
- change_state "active_project_exists", !prj.nil?
127
- change_title
114
+ active_project_action = action_collection.action('project-active_project')
115
+ default_view_action = active_project_action.add_action '&None (single files mode)'
116
+
117
+ connect Ruber[:world], SIGNAL('project_created(QObject*)'), self, SLOT('slot_project_created(QObject*)')
118
+ connect Ruber[:world], SIGNAL('closing_project(QObject*)'), self, SLOT('slot_project_closing(QObject*)')
119
+
120
+ Ruber[:world].connect SIGNAL('active_project_changed(QObject*)') do |prj|
121
+ @active_environment = Ruber[:world].environment prj
128
122
  end
129
- connect @tabs, SIGNAL('tabCloseRequested(int)'), self, SLOT('close_tab(int)')
130
- connect Ruber[:projects], SIGNAL('closing_project(QObject*)'), self, SLOT('close_project_files(QObject*)')
131
123
  setup_GUI
132
124
  create_shell_GUI true
133
125
 
@@ -148,38 +140,27 @@ is the plugin description for this object.
148
140
  action_collection.action("project-open_recent").load_entries recent_projects
149
141
  status_bar.show
150
142
  setup_initial_states
143
+ Ruber[:world].active_environment = Ruber[:world].default_environment
151
144
  end
152
145
 
153
146
  =begin rdoc
154
- The open tabs
147
+ The toplevel panes associated with the active environment
155
148
 
156
- @return [Array<Pane>] a list of the top-level pane for each tab
149
+ @return (see World::Environment#tabs)
157
150
  =end
158
151
  def tabs
159
- @tabs.to_a
152
+ @active_environment.tabs
160
153
  end
161
154
 
162
155
  =begin rdoc
163
- The views contained in the main window
164
-
165
- If a document is given as argument, returns all views associated with the document;
166
- if no document is given, all views are returned.
156
+ The views contained in the active environment
167
157
 
168
- The order of the views in the returned list is the activation order: the view
169
- which was activated more recently is at position 0 in the array, the one activated
170
- before that is at position 1 and so on. Views which have never been activated are
171
- at the end of the array, in an arbitrary order
172
-
173
- @param [Document,nil] doc the document to return the views for. If *nil*, all the
174
- views will be returned
175
- @return [Array<EditorView>] the views associated with the given document, if any,
176
- or all the views, in activation order, from most recently activated to less recently
177
- activated
158
+ @see World::Environment#views
159
+ @param (see World::Environment#views)
160
+ @return (see World::Environment#views)
178
161
  =end
179
162
  def views doc = nil
180
- if doc then @view_manager.activation_order.select{|v| v.document == doc}
181
- else @view_manager.activation_order.dup
182
- end
163
+ @active_environment.views
183
164
  end
184
165
 
185
166
  ##
@@ -296,38 +277,39 @@ hint, a new one will be created, unless the @create_if_needed@ hint is *false*.
296
277
  @raise [ArgumentError] if _doc_ is a path or a @KDE::Url@ but the corresponding
297
278
  file doesn't exist
298
279
  =end
299
- def editor_for! doc, hints = DEFAULT_HINTS
300
- hints = DEFAULT_HINTS.merge hints
301
- if hints[:new] == :replace
302
- if active_editor
303
- hints[:existing] = :never
304
- hints[:show] = false
305
- else hints[:new] = :new_tab
306
- end
307
- end
308
- docs = Ruber[:documents].documents
309
- unless doc.is_a? Document
310
- unless hints.has_key? :close_starting_document
311
- hints[:close_starting_document] = docs.size == 1 &&
312
- docs[0].extension(:ruber_default_document).default_document &&
313
- docs[0].pristine?
314
- end
315
- url = doc
316
- if url.is_a? String
317
- url = KDE::Url.new url
318
- if url.relative?
319
- path = File.expand_path url.path
320
- url.path = path
321
- end
322
- end
323
- doc = Ruber[:documents].document url
324
- end
325
- return unless doc
326
- ed = @view_manager.without_activating{@view_manager.editor_for doc, hints}
327
- if hints[:new] == :replace
328
- replace_editor active_editor, ed
329
- else ed
330
- end
280
+ def editor_for! doc, hints = {}
281
+ @active_environment.editor_for! doc, hints
282
+ # hints = DEFAULT_HINTS.merge hints
283
+ # if hints[:new] == :replace
284
+ # if active_editor
285
+ # hints[:existing] = :never
286
+ # hints[:show] = false
287
+ # else hints[:new] = :new_tab
288
+ # end
289
+ # end
290
+ # docs = Ruber[:documents].documents
291
+ # unless doc.is_a? Document
292
+ # unless hints.has_key? :close_starting_document
293
+ # hints[:close_starting_document] = docs.size == 1 &&
294
+ # docs[0].extension(:ruber_default_document).default_document &&
295
+ # docs[0].pristine?
296
+ # end
297
+ # url = doc
298
+ # if url.is_a? String
299
+ # url = KDE::Url.new url
300
+ # if url.relative?
301
+ # path = File.expand_path url.path
302
+ # url.path = path
303
+ # end
304
+ # end
305
+ # doc = Ruber[:documents].document url
306
+ # end
307
+ # return unless doc
308
+ # ed = @view_manager.without_activating{@view_manager.editor_for doc, hints}
309
+ # if hints[:new] == :replace
310
+ # replace_editor active_editor, ed
311
+ # else ed
312
+ # end
331
313
  end
332
314
 
333
315
  =begin rdoc
@@ -343,36 +325,32 @@ editor associated with the given document exists or no document corresponds to _
343
325
  @raise [ArgumentError] if _doc_ is a path or a @KDE::Url@ but the corresponding
344
326
  file doesn't exist
345
327
  =end
346
- def editor_for doc, hints = DEFAULT_HINTS
347
- hints = DEFAULT_HINTS.merge hints
348
- hints[:create_if_needed] = false
349
- unless doc.is_a? Document
350
- url = doc
351
- if url.is_a? String
352
- url = KDE::Url.new url
353
- if url.relative?
354
- path = File.expand_path url.path
355
- url.path = path
356
- end
357
- end
358
- doc = Ruber[:documents].document_for_url url
359
- end
360
- return unless doc
361
- @view_manager.editor_for doc, hints
362
- end
328
+ # def editor_for doc, hints = DEFAULT_HINTS
329
+ # hints = DEFAULT_HINTS.merge hints
330
+ # hints[:create_if_needed] = false
331
+ # unless doc.is_a? Document
332
+ # url = doc
333
+ # if url.is_a? String
334
+ # url = KDE::Url.new url
335
+ # if url.relative?
336
+ # path = File.expand_path url.path
337
+ # url.path = path
338
+ # end
339
+ # end
340
+ # doc = Ruber[:documents].document_for_url url
341
+ # end
342
+ # return unless doc
343
+ # @view_manager.editor_for doc, hints
344
+ # end
363
345
 
364
346
  =begin rdoc
365
347
  The active editor
366
348
 
367
- The active editor is the editor which has its GUI merged with the main window's.
368
- This means it is the editor which last received focus and the one which would receive
369
- focus when the tab widget does. If the focus already is in the tab widget, then
370
- the active editor is the one whose @is_active_window@ method returns *true*.
371
-
372
- @return [EditorView,nil] the active editor or *nil* if there's no active editor.
349
+ @see World::Environment#active_editor
350
+ @return (see World::Environment#active_editor)
373
351
  =end
374
352
  def active_editor
375
- @view_manager.active_editor
353
+ @active_environment.active_editor
376
354
  end
377
355
  alias_method :current_editor, :active_editor
378
356
 
@@ -391,12 +369,7 @@ signals are emitted.
391
369
  editor will be deactivated
392
370
  =end
393
371
  def activate_editor editor
394
- tab = @view_manager.tab editor
395
- return unless tab
396
- @tabs.current_widget = tab
397
- return if active_editor == editor
398
- @view_manager.make_editor_active editor
399
- editor
372
+ @active_environment.activate_editor editor
400
373
  end
401
374
 
402
375
  =begin rdoc
@@ -428,16 +401,7 @@ it).
428
401
  @return [EditorView,nil] the new editor or *nil* if the user choose to abort
429
402
  =end
430
403
  def replace_editor old, editor_or_doc
431
- if old.document.views.size == 1
432
- return unless old.document.query_close
433
- close_doc = true
434
- end
435
- if editor_or_doc.is_a?(EditorView) then ed = editor_or_doc
436
- else ed = editor_for! editor_or_doc, :existing => :never, :show => false
437
- end
438
- old.parent.replace_view old, ed
439
- close_editor old, false
440
- ed
404
+ @active_environment.replace_editor old, editor_or_doc
441
405
  end
442
406
 
443
407
  =begin rdoc
@@ -451,22 +415,19 @@ The toplevel pane corresponding to the given index or editor
451
415
  @return [Pane] the toplevel pane containing the given editor
452
416
  =end
453
417
  def tab arg
454
- @view_manager.tab arg
418
+ @active_environment.tab arg
455
419
  end
456
420
 
457
421
  =begin rdoc
458
422
  The document associated with the active editor
459
423
 
460
- This is a convenience method for @active_editor.document@ which takes care of the
461
- case when there's no active editor.
462
-
463
- @return [Document,nil] the document associated with the active editor or *nil*
464
- if there's no active editor
424
+ @see World::Environment#active_document
425
+ @return (see World::Environment#active_document)
465
426
  =end
466
- def current_document
427
+ def active_document
467
428
  (ed = active_editor) ? ed.document : nil
468
429
  end
469
- alias_method :active_document, :current_document
430
+ alias_method :current_document, :active_document
470
431
 
471
432
  =begin rdoc
472
433
  Displays an editor for the given document
@@ -487,16 +448,17 @@ Besides the keys listed in {#editor_for!}, _hints_ can also contain the two entr
487
448
  @return [EditorView,nil] the editor which has been activated or *nil* if the
488
449
  editor couldn't be found (or created)
489
450
  =end
490
- def display_doc doc, hints = DEFAULT_HINTS
491
- ed = editor_for! doc, hints
492
- return unless ed
493
- activate_editor ed
494
- line = hints[:line]
495
- ed.go_to line, hints[:column] || 0 if line
496
- ed.set_focus
497
- ed
451
+ def display_document doc, hints = {}
452
+ @active_environment.display_document doc, hints
453
+ # ed = editor_for! doc, hints
454
+ # return unless ed
455
+ # activate_editor ed
456
+ # line = hints[:line]
457
+ # ed.go_to line, hints[:column] || 0 if line
458
+ # ed.set_focus
459
+ # ed
498
460
  end
499
- alias_method :display_document, :display_doc
461
+ alias_method :display_doc, :display_document
500
462
 
501
463
  =begin rdoc
502
464
  Executes the given block without automatically activating an editor whenever the
@@ -523,43 +485,27 @@ After calling this method, the focus widget of the current tab gets focus
523
485
  @return [Object] the value returned by the block
524
486
  =end
525
487
  def without_activating &blk
526
- @view_manager.without_activating &blk
488
+ blk.call
489
+ # @view_manager.without_activating &blk
527
490
  end
528
491
 
529
492
  =begin rdoc
530
493
  Closes an editor view
531
494
 
532
- If the editor to be closed is the last editor associated with the document the
533
- document will be closed. If _ask_ is *true* and the document is modified, the user
534
- will be asked whether to save or discard the changes and will have the possibility
535
- of aborting closing the editor (and the document). If _ask_ is false, the document
536
- will be closed without user interaction.
537
-
538
- If there are other editors associated with the document besides the one to close,
539
- the latter will be closed without affecting the document.
540
-
541
- @param [EditorView] editor the editor to close
542
- @param [Boolean] ask whether or not to ask confirmation from the user if the document
543
- associated with _editor_ should be closed
544
- @return [Boolean] *true* if the editor is closed and *false* if it isn't.
495
+ @see World::Environment#close_editor
496
+ @param (see World::Environment#close_editor)
497
+ @return (see World::Environment#close_editor)
545
498
  @note Always use this method to close an editor, rather than calling its {EditorView#close close}
546
499
  method directly, unless you want to leave the corresponding document without a view
547
500
  =end
548
501
  def close_editor editor, ask = true
549
- # editor_tab = self.tab(editor)
550
- # has_focus = editor_tab.is_active_window if editor_tab
551
- # if has_focus
552
- # views = editor_tab.to_a
553
- # idx = views.index(editor)
554
- # new_view = views[idx-1] || views[idx+1]
502
+ @active_environment.close_editor editor, ask
503
+ # doc = editor.document
504
+ # if doc.views.size > 1
505
+ # editor.close
506
+ # true
507
+ # else doc.close ask
555
508
  # end
556
- doc = editor.document
557
- if doc.views.size > 1
558
- editor.close
559
- true
560
- else doc.close ask
561
- end
562
- # focus_on_editor new_view if new_view
563
509
  end
564
510
 
565
511
  =begin rdoc
@@ -648,25 +594,25 @@ The new project will be made active and the existing one (if any) will be closed
648
594
  (including the project being already open in case _allow_reuse_ is *false*)
649
595
  =end
650
596
  def safe_open_project file, allow_reuse = false
651
- prj = Ruber[:projects][file]
597
+ prj = Ruber[:world].projects[file]
652
598
  if !allow_reuse and prj
653
- text = "A project corresponding to the file #{file} is already open. Please, close it before attempting to open it again"
599
+ text = i18n("A project corresponding to the file %s is already open. Please, close it before attempting to open it again" % file)
654
600
  KDE::MessageBox.sorry self, KDE.i18n(text)
655
601
  return nil
656
602
  elsif prj then return prj
657
603
  end
658
604
  message = nil
659
- begin prj = Ruber[:projects].project file
605
+ begin prj = Ruber[:world].project file
660
606
  rescue Project::InvalidProjectFile => ex
661
607
  text = "%s isn't a valid project file. The error reported was:\n%s"
662
- message = KDE.i18n(text) % [file, ex.message]
663
- rescue LoadError then message = KDE.i18n(ex.message)
608
+ message = i18n(text) % [file, ex.message]
609
+ rescue LoadError then message = i18n(ex.message)
664
610
  end
665
611
  if prj
666
- # The following two lines should be removed when we'll allow more than one project
612
+ # The following two line should be removed when we'll allow more than one project
667
613
  # open at the same time
668
- Ruber[:projects].current_project.close if Ruber[:projects].current_project
669
- Ruber[:projects].current_project = prj
614
+ # Ruber[:projects].current_project.close if Ruber[:projects].current_project
615
+ Ruber[:world].active_project = prj
670
616
  prj
671
617
  else
672
618
  KDE::MessageBox.sorry self, message
@@ -734,15 +680,21 @@ Giving focus to the editor implies:
734
680
  @return [EditorView,nil] the editor which was given focus or *nil* if no editor
735
681
  received focus
736
682
  =end
737
- def focus_on_editor ed = nil, hints = DEFAULT_HINTS
738
- if ed
739
- ed = editor_for! ed, hints unless ed.is_a? EditorView
740
- activate_editor ed
741
- ed.set_focus
742
- else active_editor.set_focus if active_editor
743
- end
683
+ # def focus_on_editor ed = nil, hints = DEFAULT_HINTS
684
+ # if ed
685
+ # ed = editor_for! ed, hints unless ed.is_a? EditorView
686
+ # activate_editor ed
687
+ # ed.set_focus
688
+ # else active_editor.set_focus if active_editor
689
+ # end
690
+ # active_editor
691
+ # end
692
+
693
+ def focus_on_editor
694
+ active_editor.set_focus if active_editor
744
695
  active_editor
745
696
  end
697
+ slots :focus_on_editor
746
698
 
747
699
  =begin rdoc
748
700
  @return [String] the default directory where to look for, and create, projects
@@ -779,20 +731,6 @@ Executes a given action
779
731
  end
780
732
  end
781
733
 
782
- =begin rdoc
783
- Settings widget for the workspace group
784
- =end
785
- class WorkspaceSettingsWidget < Qt::Widget
786
- =begin rdoc
787
- @param [Qt::Widget,nil] parent the parent widget
788
- =end
789
- def initialize parent = nil
790
- super
791
- @ui = Ui::WorkspaceSettingsWidgetBase.new
792
- @ui.setup_ui self
793
- end
794
- end
795
-
796
734
  end
797
735
 
798
736
  end