ruber 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +21 -0
- data/data/share/apps/ruber/ruberui.rc +3 -1
- data/lib/ruber/application/application.rb +22 -23
- data/lib/ruber/application/plugin.yaml +7 -2
- data/lib/ruber/{projects → application}/project_files_list.rb +0 -0
- data/lib/ruber/{projects → application}/project_files_widget.rb +0 -0
- data/lib/ruber/application/ui/project_files_rule_chooser_widget.rb +74 -0
- data/lib/ruber/{projects → application}/ui/project_files_rule_chooser_widget.ui +0 -0
- data/lib/ruber/application/ui/project_files_widget.rb +117 -0
- data/lib/ruber/{projects → application}/ui/project_files_widget.ui +0 -0
- data/lib/ruber/component_manager.rb +14 -9
- data/lib/ruber/editor/document.rb +35 -5
- data/lib/ruber/kde_sugar.rb +16 -0
- data/lib/ruber/main_window/choose_plugins_dlg.rb +7 -4
- data/lib/ruber/main_window/main_window.rb +131 -193
- data/lib/ruber/main_window/main_window_actions.rb +157 -58
- data/lib/ruber/main_window/main_window_internal.rb +145 -54
- data/lib/ruber/main_window/open_file_in_project_dlg.rb +4 -4
- data/lib/ruber/main_window/plugin.yaml +3 -6
- data/lib/ruber/main_window/ui/workspace_settings_widget.rb +2 -2
- data/lib/ruber/main_window/workspace.rb +62 -32
- data/lib/ruber/output_widget.rb +20 -16
- data/lib/ruber/pane.rb +11 -5
- data/lib/ruber/project.rb +27 -12
- data/lib/ruber/projects/ui/project_files_rule_chooser_widget.rb +2 -2
- data/lib/ruber/projects/ui/project_files_widget.rb +2 -2
- data/lib/ruber/utils.rb +37 -4
- data/lib/ruber/version.rb +1 -1
- data/lib/ruber/world/document_factory.rb +121 -0
- data/lib/ruber/world/document_list.rb +396 -0
- data/lib/ruber/world/environment.rb +470 -0
- data/lib/ruber/{main_window → world}/hint_solver.rb +1 -1
- data/lib/ruber/world/plugin.yaml +11 -0
- data/lib/ruber/world/project_factory.rb +131 -0
- data/lib/ruber/world/project_list.rb +265 -0
- data/lib/ruber/world/ui/workspace_settings_widget.rb +51 -0
- data/lib/ruber/{main_window → world}/ui/workspace_settings_widget.ui +0 -0
- data/lib/ruber/world/world.rb +307 -0
- data/plugins/auto_end/auto_end.rb +135 -9
- data/plugins/autosave/autosave.rb +4 -4
- data/plugins/find_in_files/find_in_files.rb +5 -5
- data/plugins/find_in_files/find_in_files_widgets.rb +1 -1
- data/plugins/project_browser/project_browser.rb +4 -4
- data/plugins/rake/rake.rb +4 -4
- data/plugins/rake/rake_extension.rb +1 -1
- data/plugins/rspec/rspec.rb +4 -4
- data/plugins/rspec/ruber_rspec_formatter.rb +2 -2
- data/plugins/ruby_development/ruby_development.rb +3 -3
- data/plugins/ruby_runner/ruby_runner.rb +2 -2
- data/plugins/state/plugin.yaml +6 -8
- data/plugins/state/state.rb +201 -391
- data/plugins/state/ui/config_widget.rb +5 -5
- data/plugins/state/ui/config_widget.ui +3 -3
- data/plugins/syntax_checker/syntax_checker.rb +4 -0
- data/spec/annotation_model_spec.rb +1 -1
- data/spec/auto_end_spec.rb +98 -47
- data/spec/component_manager_spec.rb +80 -21
- data/spec/document_factory_spec.rb +115 -0
- data/spec/document_list_spec.rb +560 -450
- data/spec/document_spec.rb +143 -55
- data/spec/editor_view_spec.rb +2 -2
- data/spec/environment_spec.rb +1900 -0
- data/spec/hint_solver_spec.rb +5 -5
- data/spec/kde_sugar_spec.rb +16 -0
- data/spec/output_widget_spec.rb +177 -51
- data/spec/pane_spec.rb +29 -5
- data/spec/plugin_spec.rb +1 -1
- data/spec/project_factory_spec.rb +104 -0
- data/spec/project_list_spec.rb +352 -447
- data/spec/project_spec.rb +34 -33
- data/spec/qt_sugar_spec.rb +2 -2
- data/spec/state_spec.rb +508 -811
- data/spec/utils_spec.rb +149 -98
- data/spec/workspace_spec.rb +120 -9
- data/spec/world_spec.rb +1219 -0
- metadata +23 -14
- data/lib/ruber/documents/document_list.rb +0 -412
- data/lib/ruber/documents/plugin.yaml +0 -4
- data/lib/ruber/main_window/view_manager.rb +0 -431
- data/lib/ruber/projects/plugin.yaml +0 -11
- data/lib/ruber/projects/project_list.rb +0 -314
data/CHANGES
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
h1. Changes
|
2
2
|
|
3
|
+
h2. Ruber 0.0.9
|
4
|
+
|
5
|
+
h3. Features
|
6
|
+
|
7
|
+
h2. Ruber 0.0.9
|
8
|
+
|
9
|
+
h3. Features
|
10
|
+
|
11
|
+
* It is now possible to have more than one open project at the same time
|
12
|
+
* When a project is active, only the editors associated with it are visibile
|
13
|
+
* Editors not associated with a project are visible only when there's no active
|
14
|
+
project
|
15
|
+
* Made the Auto End plugin recognize some other keywords: @unless@, @for@, @while@,
|
16
|
+
@until@ (the last two were already recognized when followed by a @do@)
|
17
|
+
|
18
|
+
h3. Bug fixes
|
19
|
+
|
20
|
+
* The RSpec plugin now correctly displays pending examples
|
21
|
+
* Fixed a crash when creating a new document and saving it as a ruby file while
|
22
|
+
using the Syntax Checker plugin
|
23
|
+
|
3
24
|
h2. Ruber 0.0.8
|
4
25
|
|
5
26
|
h3. Features
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<!DOCTYPE kpartgui SYSTEM 'kpartgui.dtd'>
|
2
|
-
<kpartgui version="
|
2
|
+
<kpartgui version="14" name="ruber" >
|
3
3
|
<MenuBar>
|
4
4
|
<Menu name="file" >
|
5
5
|
<text>&File</text>
|
@@ -65,6 +65,8 @@
|
|
65
65
|
<Separator/>
|
66
66
|
<Action name="project-close"/>
|
67
67
|
<Separator/>
|
68
|
+
<Action name="project-active_project"/>
|
69
|
+
<Separator/>
|
68
70
|
<Action name="project-quick_open_file" />
|
69
71
|
<Separator/>
|
70
72
|
<Action name="project-configure"/>
|
@@ -85,6 +85,7 @@ Ruber can be in three states:
|
|
85
85
|
it (either with the @File/Quit@ menu entry or clicking on the button on the title
|
86
86
|
bar)
|
87
87
|
- *quitting*:= from when the user chooses to quit Ruber onwards
|
88
|
+
- *asking_to_quit*:= while asking the user to confirm quitting Ruber
|
88
89
|
|
89
90
|
>>>>>>> master
|
90
91
|
@return [Symbol] the status of the application. It can be: @:starting@, @:running@
|
@@ -141,6 +142,25 @@ write the change to file. It's up to whoever called this method to do so.
|
|
141
142
|
end
|
142
143
|
alias :plugin_dirs= :plugin_directories=
|
143
144
|
|
145
|
+
=begin rdoc
|
146
|
+
Asks the user to confirm quitting Ruber
|
147
|
+
|
148
|
+
This method is called whenever Ruber needs to be closed and, in turn, calls the
|
149
|
+
{PluginLike#query_close query_close} method of each plugin and component (using
|
150
|
+
{ComponentManager#query_close}).
|
151
|
+
|
152
|
+
During the execution of this method, {#status} returns @:asking_to_quit@. After
|
153
|
+
this method returns, the status returns what it was before.
|
154
|
+
@return [Boolean] *true* if the application can be closed and *false* otherwise
|
155
|
+
=end
|
156
|
+
def ask_to_quit
|
157
|
+
old_status = @status
|
158
|
+
@status = :asking_to_quit
|
159
|
+
res = @components.query_close
|
160
|
+
@status = old_status
|
161
|
+
res
|
162
|
+
end
|
163
|
+
|
144
164
|
=begin rdoc
|
145
165
|
Quits ruber
|
146
166
|
|
@@ -349,7 +369,7 @@ on the command line)
|
|
349
369
|
current = 'config'
|
350
370
|
@components.load_component 'config'
|
351
371
|
register_with_config
|
352
|
-
%w[
|
372
|
+
%w[world main_window].each do |i|
|
353
373
|
current = i
|
354
374
|
@components.load_component i
|
355
375
|
end
|
@@ -359,20 +379,7 @@ on the command line)
|
|
359
379
|
exit 1
|
360
380
|
end
|
361
381
|
if sessionRestored? then Ruber[:main_window].restore 1, false
|
362
|
-
else
|
363
|
-
open_command_line_files
|
364
|
-
if Ruber[:projects].projects.empty? and Ruber[:documents].documents.empty?
|
365
|
-
doc = Ruber[:documents].new_document
|
366
|
-
# This is the default document. Set the default_document attribute of
|
367
|
-
# the ruber_default_document extension to true
|
368
|
-
# TODO this extension is currently provided by the main window because
|
369
|
-
# the application component is actually loaded after the other. This
|
370
|
-
# is wrong. To avoid it, don't call load_core_components from initialize
|
371
|
-
# but have the ruber starting code (in bin/ruber) start it manually. Then
|
372
|
-
# move the extension to the application
|
373
|
-
doc.extension(:ruber_default_document).default_document = true
|
374
|
-
Ruber[:main_window].display_doc doc
|
375
|
-
end
|
382
|
+
else open_command_line_files
|
376
383
|
end
|
377
384
|
end
|
378
385
|
|
@@ -418,14 +425,6 @@ necessary to to them later
|
|
418
425
|
nil
|
419
426
|
end
|
420
427
|
|
421
|
-
class DefaultDocumentExtension
|
422
|
-
include Extension
|
423
|
-
attr_accessor :default_document
|
424
|
-
def initialize doc
|
425
|
-
@default_document = false
|
426
|
-
end
|
427
|
-
end
|
428
|
-
|
429
428
|
end
|
430
429
|
|
431
430
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
name: app
|
2
2
|
description: The application itself
|
3
|
-
require: application
|
3
|
+
require: [application, project_files_widget, project_files_list]
|
4
4
|
class: 'Ruber::Application'
|
5
5
|
config_options:
|
6
6
|
:general:
|
@@ -8,4 +8,9 @@ config_options:
|
|
8
8
|
:plugins: {:default: Ruber::Application::DEFAULT_PLUGINS}
|
9
9
|
:auto_load_project: {:default: false }
|
10
10
|
config_widgets:
|
11
|
-
- {:caption: General, :pixmap: configure, :code: "w=Qt::CheckBox.new('&Open last project at startup');w.object_name='kcfg_general_auto_load_project';w"}
|
11
|
+
- {:caption: General, :pixmap: configure, :code: "w=Qt::CheckBox.new('&Open last project at startup');w.object_name='kcfg_general_auto_load_project';w"}
|
12
|
+
project_options:
|
13
|
+
general:
|
14
|
+
project_files: {default: {:include: [], :exclude: [], :extensions: ["*.rb"]}}
|
15
|
+
extensions:
|
16
|
+
project_files: {class: ProjectFilesList}
|
File without changes
|
File without changes
|
@@ -0,0 +1,74 @@
|
|
1
|
+
=begin
|
2
|
+
** Form generated from reading ui file 'project_files_rule_chooser_widget.ui'
|
3
|
+
**
|
4
|
+
** Created: gio apr 21 20:42:42 2011
|
5
|
+
** by: Qt User Interface Compiler version 4.7.2
|
6
|
+
**
|
7
|
+
** WARNING! All changes made in this file will be lost when recompiling ui file!
|
8
|
+
=end
|
9
|
+
|
10
|
+
class Ui_ProjectFilesRuleChooser
|
11
|
+
attr_reader :gridLayout
|
12
|
+
attr_reader :remove_rule_btn
|
13
|
+
attr_reader :add_regexp_btn
|
14
|
+
attr_reader :add_path_btn
|
15
|
+
attr_reader :rules_widget
|
16
|
+
|
17
|
+
def setupUi(projectFilesRuleChooser)
|
18
|
+
if projectFilesRuleChooser.objectName.nil?
|
19
|
+
projectFilesRuleChooser.objectName = "projectFilesRuleChooser"
|
20
|
+
end
|
21
|
+
projectFilesRuleChooser.resize(505, 143)
|
22
|
+
@gridLayout = Qt::GridLayout.new(projectFilesRuleChooser)
|
23
|
+
@gridLayout.objectName = "gridLayout"
|
24
|
+
@remove_rule_btn = KDE::PushButton.new(projectFilesRuleChooser)
|
25
|
+
@remove_rule_btn.objectName = "remove_rule_btn"
|
26
|
+
|
27
|
+
@gridLayout.addWidget(@remove_rule_btn, 3, 1, 1, 1)
|
28
|
+
|
29
|
+
@add_regexp_btn = KDE::PushButton.new(projectFilesRuleChooser)
|
30
|
+
@add_regexp_btn.objectName = "add_regexp_btn"
|
31
|
+
|
32
|
+
@gridLayout.addWidget(@add_regexp_btn, 0, 1, 1, 1)
|
33
|
+
|
34
|
+
@add_path_btn = KDE::PushButton.new(projectFilesRuleChooser)
|
35
|
+
@add_path_btn.objectName = "add_path_btn"
|
36
|
+
|
37
|
+
@gridLayout.addWidget(@add_path_btn, 1, 1, 1, 1)
|
38
|
+
|
39
|
+
@rules_widget = Qt::TreeView.new(projectFilesRuleChooser)
|
40
|
+
@rules_widget.objectName = "rules_widget"
|
41
|
+
@rules_widget.rootIsDecorated = false
|
42
|
+
@rules_widget.uniformRowHeights = true
|
43
|
+
@rules_widget.allColumnsShowFocus = true
|
44
|
+
|
45
|
+
@gridLayout.addWidget(@rules_widget, 0, 0, 5, 1)
|
46
|
+
|
47
|
+
|
48
|
+
retranslateUi(projectFilesRuleChooser)
|
49
|
+
|
50
|
+
Qt::MetaObject.connectSlotsByName(projectFilesRuleChooser)
|
51
|
+
end # setupUi
|
52
|
+
|
53
|
+
def setup_ui(projectFilesRuleChooser)
|
54
|
+
setupUi(projectFilesRuleChooser)
|
55
|
+
end
|
56
|
+
|
57
|
+
def retranslateUi(projectFilesRuleChooser)
|
58
|
+
projectFilesRuleChooser.windowTitle = Qt::Application.translate("ProjectFilesRuleChooser", "Form", nil, Qt::Application::UnicodeUTF8)
|
59
|
+
@remove_rule_btn.text = Qt::Application.translate("ProjectFilesRuleChooser", "&Remove rule", nil, Qt::Application::UnicodeUTF8)
|
60
|
+
@add_regexp_btn.text = Qt::Application.translate("ProjectFilesRuleChooser", "Add ®exp rule", nil, Qt::Application::UnicodeUTF8)
|
61
|
+
@add_path_btn.text = Qt::Application.translate("ProjectFilesRuleChooser", "Add &file rule", nil, Qt::Application::UnicodeUTF8)
|
62
|
+
end # retranslateUi
|
63
|
+
|
64
|
+
def retranslate_ui(projectFilesRuleChooser)
|
65
|
+
retranslateUi(projectFilesRuleChooser)
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
module Ui
|
71
|
+
class ProjectFilesRuleChooser < Ui_ProjectFilesRuleChooser
|
72
|
+
end
|
73
|
+
end # module Ui
|
74
|
+
|
File without changes
|
@@ -0,0 +1,117 @@
|
|
1
|
+
=begin
|
2
|
+
** Form generated from reading ui file 'project_files_widget.ui'
|
3
|
+
**
|
4
|
+
** Created: gio apr 21 20:42:42 2011
|
5
|
+
** by: Qt User Interface Compiler version 4.7.2
|
6
|
+
**
|
7
|
+
** WARNING! All changes made in this file will be lost when recompiling ui file!
|
8
|
+
=end
|
9
|
+
|
10
|
+
class Ui_ProjectFilesWidget
|
11
|
+
attr_reader :verticalLayout
|
12
|
+
attr_reader :groupBox
|
13
|
+
attr_reader :gridLayout
|
14
|
+
attr_reader :label
|
15
|
+
attr_reader :extensions
|
16
|
+
attr_reader :label_2
|
17
|
+
attr_reader :include_rules
|
18
|
+
attr_reader :groupBox_2
|
19
|
+
attr_reader :gridLayout_2
|
20
|
+
attr_reader :label_3
|
21
|
+
attr_reader :exclude_rules
|
22
|
+
|
23
|
+
def setupUi(projectFilesWidget)
|
24
|
+
if projectFilesWidget.objectName.nil?
|
25
|
+
projectFilesWidget.objectName = "projectFilesWidget"
|
26
|
+
end
|
27
|
+
projectFilesWidget.resize(518, 576)
|
28
|
+
@verticalLayout = Qt::VBoxLayout.new(projectFilesWidget)
|
29
|
+
@verticalLayout.objectName = "verticalLayout"
|
30
|
+
@groupBox = Qt::GroupBox.new(projectFilesWidget)
|
31
|
+
@groupBox.objectName = "groupBox"
|
32
|
+
@gridLayout = Qt::GridLayout.new(@groupBox)
|
33
|
+
@gridLayout.objectName = "gridLayout"
|
34
|
+
@label = Qt::Label.new(@groupBox)
|
35
|
+
@label.objectName = "label"
|
36
|
+
|
37
|
+
@gridLayout.addWidget(@label, 0, 0, 1, 1)
|
38
|
+
|
39
|
+
@extensions = KDE::LineEdit.new(@groupBox)
|
40
|
+
@extensions.objectName = "extensions"
|
41
|
+
|
42
|
+
@gridLayout.addWidget(@extensions, 0, 1, 1, 1)
|
43
|
+
|
44
|
+
@label_2 = Qt::Label.new(@groupBox)
|
45
|
+
@label_2.objectName = "label_2"
|
46
|
+
@sizePolicy = Qt::SizePolicy.new(Qt::SizePolicy::Preferred, Qt::SizePolicy::Fixed)
|
47
|
+
@sizePolicy.setHorizontalStretch(0)
|
48
|
+
@sizePolicy.setVerticalStretch(0)
|
49
|
+
@sizePolicy.heightForWidth = @label_2.sizePolicy.hasHeightForWidth
|
50
|
+
@label_2.sizePolicy = @sizePolicy
|
51
|
+
|
52
|
+
@gridLayout.addWidget(@label_2, 1, 0, 1, 1)
|
53
|
+
|
54
|
+
@include_rules = Ruber::ProjectFilesRuleChooser.new(@groupBox)
|
55
|
+
@include_rules.objectName = "include_rules"
|
56
|
+
@include_rules.minimumSize = Qt::Size.new(350, 200)
|
57
|
+
@include_rules.focusPolicy = Qt::StrongFocus
|
58
|
+
|
59
|
+
@gridLayout.addWidget(@include_rules, 2, 0, 1, 2)
|
60
|
+
|
61
|
+
|
62
|
+
@verticalLayout.addWidget(@groupBox)
|
63
|
+
|
64
|
+
@groupBox_2 = Qt::GroupBox.new(projectFilesWidget)
|
65
|
+
@groupBox_2.objectName = "groupBox_2"
|
66
|
+
@gridLayout_2 = Qt::GridLayout.new(@groupBox_2)
|
67
|
+
@gridLayout_2.objectName = "gridLayout_2"
|
68
|
+
@label_3 = Qt::Label.new(@groupBox_2)
|
69
|
+
@label_3.objectName = "label_3"
|
70
|
+
@sizePolicy.heightForWidth = @label_3.sizePolicy.hasHeightForWidth
|
71
|
+
@label_3.sizePolicy = @sizePolicy
|
72
|
+
|
73
|
+
@gridLayout_2.addWidget(@label_3, 0, 0, 1, 1)
|
74
|
+
|
75
|
+
@exclude_rules = Ruber::ProjectFilesRuleChooser.new(@groupBox_2)
|
76
|
+
@exclude_rules.objectName = "exclude_rules"
|
77
|
+
@exclude_rules.minimumSize = Qt::Size.new(350, 200)
|
78
|
+
@exclude_rules.focusPolicy = Qt::StrongFocus
|
79
|
+
|
80
|
+
@gridLayout_2.addWidget(@exclude_rules, 1, 0, 1, 1)
|
81
|
+
|
82
|
+
|
83
|
+
@verticalLayout.addWidget(@groupBox_2)
|
84
|
+
|
85
|
+
@label.buddy = @extensions
|
86
|
+
@label_2.buddy = @include_rules
|
87
|
+
@label_3.buddy = @include_rules
|
88
|
+
|
89
|
+
retranslateUi(projectFilesWidget)
|
90
|
+
|
91
|
+
Qt::MetaObject.connectSlotsByName(projectFilesWidget)
|
92
|
+
end # setupUi
|
93
|
+
|
94
|
+
def setup_ui(projectFilesWidget)
|
95
|
+
setupUi(projectFilesWidget)
|
96
|
+
end
|
97
|
+
|
98
|
+
def retranslateUi(projectFilesWidget)
|
99
|
+
projectFilesWidget.windowTitle = Qt::Application.translate("ProjectFilesWidget", "Form", nil, Qt::Application::UnicodeUTF8)
|
100
|
+
@groupBox.title = Qt::Application.translate("ProjectFilesWidget", "Files to include", nil, Qt::Application::UnicodeUTF8)
|
101
|
+
@label.text = Qt::Application.translate("ProjectFilesWidget", "Extensions", nil, Qt::Application::UnicodeUTF8)
|
102
|
+
@label_2.text = Qt::Application.translate("ProjectFilesWidget", "&Rules", nil, Qt::Application::UnicodeUTF8)
|
103
|
+
@groupBox_2.title = Qt::Application.translate("ProjectFilesWidget", "Files to exclude", nil, Qt::Application::UnicodeUTF8)
|
104
|
+
@label_3.text = Qt::Application.translate("ProjectFilesWidget", "&Rules", nil, Qt::Application::UnicodeUTF8)
|
105
|
+
end # retranslateUi
|
106
|
+
|
107
|
+
def retranslate_ui(projectFilesWidget)
|
108
|
+
retranslateUi(projectFilesWidget)
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
module Ui
|
114
|
+
class ProjectFilesWidget < Ui_ProjectFilesWidget
|
115
|
+
end
|
116
|
+
end # module Ui
|
117
|
+
|
File without changes
|
@@ -574,8 +574,10 @@ Method required for the Plugin interface. Does nothing
|
|
574
574
|
components are passed in reverse loading order (i.e., the last loaded component
|
575
575
|
will be the first passed to the block.)
|
576
576
|
=end
|
577
|
-
def each_component #:yields: comp
|
578
|
-
@components.reverse_each{|k, v| yield v}
|
577
|
+
def each_component order = :normal #:yields: comp
|
578
|
+
if order == :reverse then @components.reverse_each{|k, v| yield v}
|
579
|
+
else @components.each{|k, v| yield v}
|
580
|
+
end
|
579
581
|
end
|
580
582
|
|
581
583
|
=begin rdoc
|
@@ -584,8 +586,9 @@ Method required for the Plugin interface. Does nothing
|
|
584
586
|
plugins are passed in reverse loading order (i.e., the last loaded plugin
|
585
587
|
will be the first passed to the block.)
|
586
588
|
=end
|
587
|
-
def each_plugin #:yields: plug
|
588
|
-
@components.
|
589
|
+
def each_plugin order = :normal #:yields: plug
|
590
|
+
meth = @components.method(order == :reverse ? :reverse_each : :each)
|
591
|
+
meth.call do |k, v|
|
589
592
|
yield v if v.is_a?(Ruber::Plugin)
|
590
593
|
end
|
591
594
|
end
|
@@ -635,7 +638,7 @@ Method required for the Plugin interface. Does nothing
|
|
635
638
|
end
|
636
639
|
file = File.join dir, 'plugin.yaml'
|
637
640
|
pdf = PluginSpecification.full file
|
638
|
-
parent = Ruber[:app] rescue self
|
641
|
+
parent = @components[:app] || self #Ruber[:app] rescue self
|
639
642
|
comp = pdf.class_obj.new parent, pdf
|
640
643
|
emit component_loaded(comp)
|
641
644
|
comp
|
@@ -770,9 +773,9 @@ Method required for the Plugin interface. Does nothing
|
|
770
773
|
* delete all the plugins from the list of loaded components.
|
771
774
|
=end
|
772
775
|
def shutdown
|
773
|
-
each_component{|c| c.save_settings unless c.equal?(self)}
|
776
|
+
each_component(:reverse){|c| c.save_settings unless c.equal?(self)}
|
774
777
|
@components[:config].write
|
775
|
-
each_component{|c| c.shutdown unless c.equal? self}
|
778
|
+
each_component(:reverse){|c| c.shutdown unless c.equal? self}
|
776
779
|
# @components[:config].write
|
777
780
|
# each_component do |c|
|
778
781
|
# unless c.equal? self
|
@@ -802,7 +805,9 @@ Method required for the Plugin interface. Does nothing
|
|
802
805
|
=end
|
803
806
|
def unload_plugin name
|
804
807
|
plug = @components[name]
|
805
|
-
raise ArgumentError, "
|
808
|
+
if plug.nil? then raise ArgumentError, "No plugin with name #{name}"
|
809
|
+
elsif !plug.is_a?(Plugin) then raise ArgumentError, "A component can't be unloaded"
|
810
|
+
end
|
806
811
|
# plug.save_settings
|
807
812
|
plug.plugin_description.features.each do |f|
|
808
813
|
emit method("unloading_#{f}").call( plug )
|
@@ -822,7 +827,7 @@ Method required for the Plugin interface. Does nothing
|
|
822
827
|
This method is intented to be called from <tt>MainWindow#queryClose</tt>.
|
823
828
|
=end
|
824
829
|
def query_close
|
825
|
-
res = each_component do |c|
|
830
|
+
res = each_component(:reverse) do |c|
|
826
831
|
unless c.equal? self
|
827
832
|
break false unless c.query_close
|
828
833
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
=begin
|
2
|
-
Copyright (C) 2010 by Stefano Crocco
|
2
|
+
Copyright (C) 2010, 2011 by Stefano Crocco
|
3
3
|
stefano.crocco@alice.it
|
4
4
|
|
5
5
|
This program is free software; you can redistribute it andor modify
|
@@ -30,6 +30,36 @@ require 'ruber/document_project'
|
|
30
30
|
module Ruber
|
31
31
|
|
32
32
|
class Document < Qt::Object
|
33
|
+
|
34
|
+
# @docs = {}
|
35
|
+
# @close_mapper = Qt::SignalMapper.new
|
36
|
+
# @close_mapper.connect(SIGNAL('mapped(QObject*)')) do |d|
|
37
|
+
# @docs.delete d.url
|
38
|
+
# end
|
39
|
+
# @rename_mapper = Qt::SignalMapper.new
|
40
|
+
# @rename_mapper.connect(SIGNAL('mapped(QObject*)')) do |d|
|
41
|
+
# @docs.reject!{|k, v| v == d}
|
42
|
+
# @docs[d.url] = d
|
43
|
+
# end
|
44
|
+
|
45
|
+
# def self.new *args, &blk
|
46
|
+
# file = args[0]
|
47
|
+
# doc = if file
|
48
|
+
# url = KDE::Url.new file
|
49
|
+
# existing_doc = @docs[url]
|
50
|
+
# return existing_doc if existing_doc
|
51
|
+
# new_doc = super
|
52
|
+
# Qt::Object.connect new_doc, SIGNAL('closing(QObject*)'), @close_mapper,
|
53
|
+
# SLOT(:map)
|
54
|
+
# @close_mapper.set_mapping new_doc, new_doc
|
55
|
+
# new_url = new_doc.url if url.valid?
|
56
|
+
# @docs[new_url] = new_doc
|
57
|
+
# else super
|
58
|
+
# end
|
59
|
+
# Qt::Object.connect doc, SIGNAL('document_url_changed(QObject*)'), @rename_mapper, SLOT(:map)
|
60
|
+
# @rename_mapper.set_mapping doc, doc
|
61
|
+
# doc
|
62
|
+
# end
|
33
63
|
|
34
64
|
extend Forwardable
|
35
65
|
|
@@ -85,7 +115,7 @@ it is still included in the array returned by {#views}
|
|
85
115
|
=begin rdoc
|
86
116
|
Creates a new Ruber::Document.
|
87
117
|
=end
|
88
|
-
def initialize
|
118
|
+
def initialize file = nil, parent = nil
|
89
119
|
super parent
|
90
120
|
@active = false
|
91
121
|
@doc = KTextEditor::EditorChooser.editor('katepart').create_document( self)
|
@@ -139,7 +169,7 @@ Creates a new Ruber::Document.
|
|
139
169
|
end
|
140
170
|
|
141
171
|
=begin rdoc
|
142
|
-
@return [Array<EditorView>] a list of the views
|
172
|
+
@return [Array<EditorView>] a list of all the views associated with the document
|
143
173
|
=end
|
144
174
|
def views
|
145
175
|
@views.dup
|
@@ -325,7 +355,7 @@ Return the project with wider scope the document belongs to. This is:
|
|
325
355
|
associated with a file or the file doesn't belong the global project
|
326
356
|
=end
|
327
357
|
def project
|
328
|
-
prj = Ruber[:
|
358
|
+
prj = Ruber[:world].active_project
|
329
359
|
return @project if path.empty? or !prj
|
330
360
|
prj.project_files.file_in_project?(url.to_encoded.to_s) ? prj : @project
|
331
361
|
end
|
@@ -440,7 +470,7 @@ encoding here is set to UTF-8 if using ruby 1.9 and to ISO-8859-1 if using ruby
|
|
440
470
|
=end
|
441
471
|
def document_save_as
|
442
472
|
enc = RUBY_VERSION.match(/1\.9/) ? 'UTF-8' : 'ISO-8859-1'
|
443
|
-
prj = Ruber[:
|
473
|
+
prj = Ruber[:world].active_project
|
444
474
|
path = if !self.path.empty? then self.path
|
445
475
|
elsif prj then prj.project_directory
|
446
476
|
else ''
|