ruber 0.0.8 → 0.0.9
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.
- 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
@@ -110,10 +110,10 @@ module Ruber
|
|
110
110
|
=====Arguments
|
111
111
|
_parent_:: the widget parent of the dialog
|
112
112
|
=end
|
113
|
-
def initialize parent = nil
|
114
|
-
super
|
115
|
-
files =
|
116
|
-
@base_dir =
|
113
|
+
def initialize prj, parent = nil
|
114
|
+
super parent
|
115
|
+
files = prj.project_files.to_a
|
116
|
+
@base_dir = prj.project_directory
|
117
117
|
@ui = Ui::OpenFileInProjectDlg.new
|
118
118
|
@ui.setupUi self
|
119
119
|
@ui.regexp_error.hide
|
@@ -29,18 +29,16 @@ config_options:
|
|
29
29
|
v_splitter: {key: Vertical splitter, type: string list, default: "['80', '20']"}
|
30
30
|
workspace:
|
31
31
|
tools_sizes: {default: {}}
|
32
|
-
close_buttons: {default: 'true', type: bool}
|
33
32
|
config_widgets:
|
34
33
|
- {caption: General, pixmap: configure, class: Ruber::MainWindowSettingsWidget}
|
35
34
|
- {caption: Colors, pixmap: fill-color, class: Ruber::OutputColorWidget}
|
36
|
-
- {caption: Workspace, pixmap: workspace.png, class: Ruber::MainWindow::WorkspaceSettingsWidget}
|
37
35
|
actions:
|
38
36
|
file_new: {standard_action: open_new, slot: new_file()}
|
39
37
|
file_open: {standard_action: open, slot: open_file()}
|
40
38
|
file_open_recent: {standard_action: open_recent, signal: urlSelected(KUrl), slot: open_recent_file(KUrl)}
|
41
39
|
file-save_all: {text: Save &All, icon: document-save-all, slot: save_all()}
|
42
40
|
file_close: {standard_action: close, slot: close_current_editor()}
|
43
|
-
file-close_tab: {text: Close Current &Tab, slot:
|
41
|
+
file-close_tab: {text: Close Current &Tab, slot: close_current_tab(), state: current_document}
|
44
42
|
file-close_all: {text: Clos&e All, slot: close_all_views(), state: current_document}
|
45
43
|
file-close_other: {text: Close All O&ther, slot: close_other_views(), state: current_document}
|
46
44
|
file_quit: {standard_action: quit, receiver: 'Ruber[:app]', slot: closeAllWindows()}
|
@@ -56,6 +54,7 @@ actions:
|
|
56
54
|
project-close: {text: '&Close Project', slot: close_current_project(), state: active_project_exists}
|
57
55
|
project-quick_open_file: {text: '&Quick Open File', icon: document-open, shortcut: Alt+Ctrl+O, slot: open_file_in_project(), state: active_project_exists}
|
58
56
|
project-configure: {text: Co&nfigure Project..., icon: configure, slot: configure_project(), state: active_project_exists}
|
57
|
+
project-active_project: {text: '&Active Project', signal: 'triggered(QAction*)', class: KDE::SelectAction, slot: 'change_active_project(QAction*)'}
|
59
58
|
options-choose_plugins: {text: C&hoose Plugins..., icon: preferences-plugin, slot: choose_plugins()}
|
60
59
|
options_configure: {standard_action: preferences, slot: preferences()}
|
61
60
|
configure_document: {text: Configure &Document, icon: configure, slot: configure_document(), state: current_document}
|
@@ -68,6 +67,4 @@ actions:
|
|
68
67
|
window-next_horizontally: {text: Next View Horizontally, slot: move_among_views(), state: current_document, shortcut: Ctrl+Alt+Right}
|
69
68
|
window-next_vertically: {text: Next View Vertically, slot: move_among_views(), state: current_document, shortcut: Ctrl+Alt+PgDown}
|
70
69
|
window-previous_horizontally: {text: Previous View Horizontally, slot: move_among_views(), state: current_document, shortcut: Ctrl+Alt+Left}
|
71
|
-
window-previous_vertically: {text: Previous View Vertically, slot: move_among_views(), state: current_document, shortcut: Ctrl+Alt+PgUp}
|
72
|
-
extensions:
|
73
|
-
ruber_default_document: {class: Ruber::Application::DefaultDocumentExtension, scope: document, place: all}
|
70
|
+
window-previous_vertically: {text: Previous View Vertically, slot: move_among_views(), state: current_document, shortcut: Ctrl+Alt+PgUp}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
=begin
|
2
2
|
** Form generated from reading ui file 'workspace_settings_widget.ui'
|
3
3
|
**
|
4
|
-
** Created:
|
5
|
-
** by: Qt User Interface Compiler version 4.7.
|
4
|
+
** Created: lun apr 18 09:11:58 2011
|
5
|
+
** by: Qt User Interface Compiler version 4.7.2
|
6
6
|
**
|
7
7
|
** WARNING! All changes made in this file will be lost when recompiling ui file!
|
8
8
|
=end
|
@@ -23,24 +23,34 @@ require 'facets/enumerable/sum'
|
|
23
23
|
module Ruber
|
24
24
|
|
25
25
|
=begin rdoc
|
26
|
-
Widget representing the main area of Ruber's main window
|
27
|
-
|
26
|
+
Widget representing the main area of Ruber's main window. It contains the space
|
27
|
+
for the main widget (that is, the tab widget where the editors are located) and
|
28
|
+
the tool widgets, together with their tab bars.
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
To allow for several main widgets existing (but not being visible) at the same time
|
31
|
+
(one main widget for each environment) the space for the main widget is given by
|
32
|
+
a single @Qt::StackedWidget@, where the different main widgets are placed using
|
33
|
+
{#add_widget}. {#main_widget=} is then used to bring one of the main widgets to
|
34
|
+
the foreground; {#remove_widget} removes a widget from the stacked widget (to be
|
35
|
+
used when a project is closed).
|
33
36
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
37
|
+
The workspace provides three _tool widgets containers_, one on each side of the
|
38
|
+
main widget except above it. The container on each side is indipendent from the
|
39
|
+
others. The containers have buttons for their tool widgets and a @Qt::StackedWidget@
|
40
|
+
for the widget themselves. Each container is indipendent from the other ones
|
41
|
+
|
42
|
+
A tool widget can be in several different states:
|
43
|
+
* _raised_ or _lowered_: a tool widget is _raised_ when it's on the top of its container
|
44
|
+
stacked widget. There can be only one raised tool widget for side. All tool widgets
|
45
|
+
which aren't raised are said to be _lowered_
|
46
|
+
* _visible_ or _hidden_: each tool widget container can be visible or hidden. The
|
47
|
+
raised tool widget in a visible container is said to be _visible_. Widgets in
|
48
|
+
an hidden container are said to be _hidden_.
|
49
|
+
* _active_ or _inactive_: the _active_ tool widget is the one which has keyboard
|
50
|
+
focus; all others are _inactive_. Of course there can be at most one active tool
|
51
|
+
widget across the whole workspace. If the focus is not in one of the tool widgets
|
52
|
+
(most likely meaning one of the editors has focus), all tool widgets will be
|
53
|
+
inactive.
|
44
54
|
=end
|
45
55
|
class Workspace < Qt::Widget
|
46
56
|
|
@@ -112,17 +122,12 @@ Internal class used to store information about the position of a tool widget
|
|
112
122
|
signals 'tool_shown(QWidget*)'
|
113
123
|
|
114
124
|
slots 'toggle_tool(int)'
|
115
|
-
|
125
|
+
|
116
126
|
=begin rdoc
|
117
|
-
|
118
|
-
=end
|
119
|
-
# attr_reader :views
|
120
|
-
|
121
|
-
=begin rdoc
|
122
|
-
Creates a new Workspace. _parent_ is the workspace's parent widget
|
127
|
+
@param [Qt::Widget,nil] parent the parent widget
|
123
128
|
=end
|
124
129
|
def initialize parent = nil
|
125
|
-
super
|
130
|
+
super parent
|
126
131
|
@button_bars = {}
|
127
132
|
@splitters = {}
|
128
133
|
@stacks = {}
|
@@ -133,14 +138,38 @@ Creates a new Workspace. _parent_ is the workspace's parent widget
|
|
133
138
|
create_skeleton
|
134
139
|
end
|
135
140
|
|
141
|
+
def add_widget w
|
142
|
+
@main_widget.add_widget w
|
143
|
+
end
|
144
|
+
|
145
|
+
def remove_widget w
|
146
|
+
@main_widget.remove_widget w
|
147
|
+
end
|
148
|
+
|
149
|
+
def main_widget
|
150
|
+
@main_widget.current_widget
|
151
|
+
end
|
152
|
+
|
153
|
+
def main_widget= w
|
154
|
+
unless @main_widget.include? w
|
155
|
+
Kernel.raise ArgumentError, "a widget which has not been added to the workspace can\'t become the main widget"
|
156
|
+
end
|
157
|
+
@main_widget.current_widget = w
|
158
|
+
end
|
159
|
+
|
136
160
|
=begin rdoc
|
137
|
-
Adds a tool widget to the workspace
|
138
|
-
be put. It can be <tt>:left</tt>, <tt>:right</tt> or <tt>:bottom</tt>. _widget_
|
139
|
-
is the widget to add; _icon_ is the <tt>Qt::Pixmap</tt> containing the icon to
|
140
|
-
put on the tab bar and _caption_ is the text to display on the same caption.
|
161
|
+
Adds a tool widget to the workspace
|
141
162
|
|
142
|
-
|
143
|
-
|
163
|
+
@param [Symbol] side the side where the tool widget should be put. It can be
|
164
|
+
@:left@, @:right@ or @:bottom@
|
165
|
+
@param [Qt::Widget] widget the widget to add
|
166
|
+
@param [Qt::Pixmap] icon the icon to show on the button associated with the tool
|
167
|
+
widget
|
168
|
+
@param [String] caption the text to show on the button associated with the tool
|
169
|
+
widget
|
170
|
+
@raise [ArgumentError] if the same tool widget had already been added to the workspace
|
171
|
+
(either on the same side or on another side)
|
172
|
+
@return [nil]
|
144
173
|
=end
|
145
174
|
def add_tool_widget side, widget, icon, caption
|
146
175
|
if @stacks.values.include? widget.parent
|
@@ -153,6 +182,7 @@ another side, then ArgumentError is raised).
|
|
153
182
|
@stacks[side].add_widget widget
|
154
183
|
connect bar.tab(id), SIGNAL('clicked(int)'), self, SLOT('toggle_tool(int)')
|
155
184
|
@next_id += 1
|
185
|
+
nil
|
156
186
|
end
|
157
187
|
|
158
188
|
=begin rdoc
|
@@ -357,8 +387,8 @@ splitters and tab view)
|
|
357
387
|
v.add_widget h
|
358
388
|
v.add_widget @stacks[:bottom]
|
359
389
|
h.add_widget @stacks[:left]
|
360
|
-
@
|
361
|
-
h.add_widget @
|
390
|
+
@main_widget = Qt::StackedWidget.new self
|
391
|
+
h.add_widget @main_widget
|
362
392
|
h.add_widget @stacks[:right]
|
363
393
|
end
|
364
394
|
|
data/lib/ruber/output_widget.rb
CHANGED
@@ -826,17 +826,17 @@ corresponding item by overriding this method to always return *nil*.
|
|
826
826
|
return unless res
|
827
827
|
res = Array res
|
828
828
|
res << 0 if res.size == 1
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
else nil
|
829
|
+
res[0].sub!(%r{^file://},'')
|
830
|
+
unless res[0].match(%r{^.+://})
|
831
|
+
path = Pathname.new(res[0])
|
832
|
+
begin
|
833
|
+
res[0] = path.realpath(@working_dir).to_s
|
834
|
+
return nil unless File.file? res[0]
|
835
|
+
rescue Errno::ENOENT
|
836
|
+
return nil
|
838
837
|
end
|
839
838
|
end
|
839
|
+
res
|
840
840
|
end
|
841
841
|
|
842
842
|
=begin rdoc
|
@@ -936,12 +936,13 @@ is valid and <tt>Qt::NoItemFlags</tt> if it isn't vaid.
|
|
936
936
|
|
937
937
|
If <tt>global_flags</tt> is *nil*, this method behaves as <tt>Qt::StandardModel#flags</tt>.
|
938
938
|
=end
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
939
|
+
# def flags idx
|
940
|
+
# super
|
941
|
+
# if @global_flags
|
942
|
+
# idx.valid? ? @global_flags : Qt::NoItemFlags
|
943
|
+
# else super
|
944
|
+
# end
|
945
|
+
# end
|
945
946
|
|
946
947
|
=begin rdoc
|
947
948
|
Changes content of the given element.
|
@@ -965,6 +966,7 @@ Returns the new item.
|
|
965
966
|
col = opts[:col] || 0
|
966
967
|
parent = opts[:parent]
|
967
968
|
it = Qt::StandardItem.new(text)
|
969
|
+
it.flags = @global_flags if @global_flags
|
968
970
|
row = (parent || self).row_count + row if row < 0
|
969
971
|
col = (parent || self).column_count + col if col < 0
|
970
972
|
if parent then parent.set_child row, col, it
|
@@ -1032,7 +1034,9 @@ This method returns an array containing all the non-empty items of the new row.
|
|
1032
1034
|
end
|
1033
1035
|
text = Array.new(col) << text unless text.is_a? Array
|
1034
1036
|
items = text.map do |i|
|
1035
|
-
i ? Qt::StandardItem.new(i) : Qt::StandardItem.new
|
1037
|
+
it = i ? Qt::StandardItem.new(i) : Qt::StandardItem.new
|
1038
|
+
it.flags = @global_flags if @global_flags
|
1039
|
+
it
|
1036
1040
|
end
|
1037
1041
|
parent.insert_row row, items
|
1038
1042
|
items.delete_if{|i| i.text.nil?}
|
data/lib/ruber/pane.rb
CHANGED
@@ -147,6 +147,8 @@ Signal emitted whenever the single view associated with the paned is about to be
|
|
147
147
|
=begin rdoc
|
148
148
|
Signal emitted whenever a view in the pane or one of its children has been removed
|
149
149
|
|
150
|
+
In slots connected to this signal, calls to {#view} will return *nil*.
|
151
|
+
|
150
152
|
@param [Pane] pane the pane the view was child of
|
151
153
|
@param [Qt::Widget] view the view which was removed from the pane. Note that when
|
152
154
|
this signal is emitted, the view hasn't as yet been destroyed, but it has already
|
@@ -401,7 +403,8 @@ Iterates on all views contained in the pane
|
|
401
403
|
This method always acts recursively, meaning that views indirectly contained in
|
402
404
|
the pane are returned.
|
403
405
|
|
404
|
-
If the pane is in single view mode, that only view is passed to the block.
|
406
|
+
If the pane is in single view mode, that only view is passed to the block. If the
|
407
|
+
only view has been closed, the block is not called.
|
405
408
|
|
406
409
|
@yieldparam [EditorView] view a view contained (directly) in the pane
|
407
410
|
@return [Pane,Enumerator] if a block is given then *self*, otherwise an Enumerator
|
@@ -409,8 +412,8 @@ If the pane is in single view mode, that only view is passed to the block.
|
|
409
412
|
=end
|
410
413
|
def each_view &blk
|
411
414
|
return to_enum(:each_view) unless block_given?
|
412
|
-
if single_view? then yield @view
|
413
|
-
|
415
|
+
if single_view? and @view.parent then yield @view
|
416
|
+
elsif !single_view?
|
414
417
|
each_pane(:recursive) do |pn|
|
415
418
|
yield pn.view if pn.single_view?
|
416
419
|
end
|
@@ -514,7 +517,8 @@ It does nothing if the splitter is already in single view mode
|
|
514
517
|
keeping_focus view do
|
515
518
|
@view = view
|
516
519
|
@view.parent = self unless @view.parent == self
|
517
|
-
@splitter.each{|w| w
|
520
|
+
@splitter.each{|w| take_pane w}
|
521
|
+
# @splitter.each{|w| w.disconnect SIGNAL('closing_last_view(QWidget*)'), self, SLOT('remove_pane(QWidget*)')}
|
518
522
|
layout.remove_widget @splitter
|
519
523
|
layout.insert_widget 0, @view
|
520
524
|
self.label = label
|
@@ -526,7 +530,6 @@ It does nothing if the splitter is already in single view mode
|
|
526
530
|
end
|
527
531
|
end
|
528
532
|
|
529
|
-
|
530
533
|
private
|
531
534
|
|
532
535
|
def keeping_focus *widgets
|
@@ -591,6 +594,8 @@ Slot called when the single view contained in the pane is closed
|
|
591
594
|
It emis the {#closing_last_view} signal passing *self* as argument, makes the
|
592
595
|
view parentless and schedules *self* for deletion.
|
593
596
|
|
597
|
+
After this method as been called (in particular, in slots connected to the {#remove_view} signal), calls to {#view} will return *nil*.
|
598
|
+
|
594
599
|
*Note:* this method assumes the {Pane} is in single view mode
|
595
600
|
@param [EditorView] view the view which is being closed
|
596
601
|
@return [nil]
|
@@ -598,6 +603,7 @@ view parentless and schedules *self* for deletion.
|
|
598
603
|
def remove_view view
|
599
604
|
emit closing_last_view(self)
|
600
605
|
@view.parent = nil
|
606
|
+
@view = nil
|
601
607
|
emit removing_view self, view
|
602
608
|
delete_later
|
603
609
|
nil
|
data/lib/ruber/project.rb
CHANGED
@@ -111,8 +111,6 @@ When the project is created, it's not active.
|
|
111
111
|
def initialize parent, backend, name = nil
|
112
112
|
super(parent)
|
113
113
|
@active = false
|
114
|
-
Ruber[:components].named_connect(SIGNAL('component_loaded(QObject*)'), "register_component_with_project #{object_id}"){|c| c.register_with_project self}
|
115
|
-
Ruber[:components].named_connect(SIGNAL('unloading_component(QObject*)'), "remove_component_from_project #{object_id}"){|c| c.remove_from_project self}
|
116
114
|
@project_file = backend.file
|
117
115
|
setup_container backend, project_dir
|
118
116
|
@dialog_class = ProjectDialog
|
@@ -130,6 +128,8 @@ When the project is created, it's not active.
|
|
130
128
|
raise InvalidProjectFile, "You need to specify a project name for a new project"
|
131
129
|
end
|
132
130
|
@project_extensions = {}
|
131
|
+
Ruber[:components].named_connect(SIGNAL('component_loaded(QObject*)'), "register_component_with_project #{object_id}"){|c| c.register_with_project self}
|
132
|
+
Ruber[:components].named_connect(SIGNAL('unloading_component(QObject*)'), "remove_component_from_project #{object_id}"){|c| c.remove_from_project self}
|
133
133
|
Ruber[:components].each_component{|c| c.register_with_project self}
|
134
134
|
end
|
135
135
|
|
@@ -263,7 +263,7 @@ name doesn't exist, or if _args_ is not empty, +ArgumentError+ is raised.
|
|
263
263
|
puts "Arguments: #{args.empty? ? '[]' : args.join( ', ')}"
|
264
264
|
end
|
265
265
|
raise ArgumentError, "wrong number of arguments (#{args.size} for 0)" unless args.empty?
|
266
|
-
@project_extensions
|
266
|
+
@project_extensions[name] || super
|
267
267
|
end
|
268
268
|
end
|
269
269
|
|
@@ -289,17 +289,27 @@ writing the settings to file
|
|
289
289
|
end
|
290
290
|
|
291
291
|
=begin rdoc
|
292
|
-
Closes the project
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
292
|
+
Closes the project
|
293
|
+
|
294
|
+
According to the _save_ parameter, the project may save itself and its extensions\'
|
295
|
+
settings or not. In the first case, extensions may stop the project from closing
|
296
|
+
by having their @query_close@ method return *false*. If _save_ is false, nothing
|
297
|
+
will be saved and the closing can't be interrupted.
|
298
|
+
|
299
|
+
Before closing the project, the {#closing} signal is emitted. After that, all extensions
|
300
|
+
will be removed (calling their @remove_from_project@ method if they have one).
|
301
|
+
|
302
|
+
@param [Boolean] save whether or not to save the project and the extensions\'
|
303
|
+
settings. If *true*, the extensions will also have a chance to abort closing by
|
304
|
+
returning *false* from their @query_close@ method
|
305
|
+
@return [Boolean] *true* if the project was closed correctly and *false* if the
|
306
|
+
project couldn\'t be closed, either because some of the extensions\' @query_close@
|
307
|
+
method returned *false* or because the project itself couldn\'t be saved for some
|
308
|
+
reason.
|
300
309
|
=end
|
301
310
|
def close save = true
|
302
311
|
if save
|
312
|
+
return false unless query_close
|
303
313
|
return false unless self.save
|
304
314
|
end
|
305
315
|
emit closing(self)
|
@@ -355,6 +365,11 @@ If _file_ is a relative path, it's considered relative to the current directory.
|
|
355
365
|
|
356
366
|
If the project file _file_ already exists but it's not a valid project file,
|
357
367
|
AbstractProject::InvalidProjectFile will be raised.
|
368
|
+
|
369
|
+
@param [String] file the path of the project file (it doesn't need to exist)
|
370
|
+
@param [String,nil] name the name of the project. If the project file already exists,
|
371
|
+
then this should be *nil*. If the project file doesn't exist, this should *not*
|
372
|
+
be *nil*
|
358
373
|
=end
|
359
374
|
def initialize file, name = nil
|
360
375
|
file = File.join(Dir.pwd, file) unless file.start_with? '/'
|
@@ -362,7 +377,7 @@ AbstractProject::InvalidProjectFile will be raised.
|
|
362
377
|
rescue YamlSettingsBackend::InvalidSettingsFile => e
|
363
378
|
raise Ruber::AbstractProject::InvalidProjectFile, e.message
|
364
379
|
end
|
365
|
-
super Ruber[:
|
380
|
+
super Ruber[:world], back, name
|
366
381
|
end
|
367
382
|
|
368
383
|
=begin rdoc
|
@@ -1,8 +1,8 @@
|
|
1
1
|
=begin
|
2
2
|
** Form generated from reading ui file 'project_files_rule_chooser_widget.ui'
|
3
3
|
**
|
4
|
-
** Created:
|
5
|
-
** by: Qt User Interface Compiler version 4.7.
|
4
|
+
** Created: lun apr 18 09:11:58 2011
|
5
|
+
** by: Qt User Interface Compiler version 4.7.2
|
6
6
|
**
|
7
7
|
** WARNING! All changes made in this file will be lost when recompiling ui file!
|
8
8
|
=end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
=begin
|
2
2
|
** Form generated from reading ui file 'project_files_widget.ui'
|
3
3
|
**
|
4
|
-
** Created:
|
5
|
-
** by: Qt User Interface Compiler version 4.7.
|
4
|
+
** Created: lun apr 18 09:11:58 2011
|
5
|
+
** by: Qt User Interface Compiler version 4.7.2
|
6
6
|
**
|
7
7
|
** WARNING! All changes made in this file will be lost when recompiling ui file!
|
8
8
|
=end
|
data/lib/ruber/utils.rb
CHANGED
@@ -336,6 +336,9 @@ those signals, everything else will still work (in the rest of the documentation
|
|
336
336
|
every time emitting a signal is mentioned, it's understood that the signal won't
|
337
337
|
be emitted if it doesn't exist).
|
338
338
|
|
339
|
+
Classes including this module may customize what is done when the state change by
|
340
|
+
overriding the {#do_activation} and {#do_deactivation} methods.
|
341
|
+
|
339
342
|
Classes mixing-in this module should initialize an instance variable called
|
340
343
|
<tt>@active</tt>. If they don't, one initialized to *nil* will be created the first
|
341
344
|
time it'll be needed (possibly with a warning).
|
@@ -374,8 +377,8 @@ If previously the object was inactive, emits the @activated@ signal.
|
|
374
377
|
=begin rdoc
|
375
378
|
Enables or disables the object
|
376
379
|
|
377
|
-
If the state of the object changes, the
|
378
|
-
|
380
|
+
If the state of the object changes, the {#do_activation} or {#do_deactivation}
|
381
|
+
methods are called. This happens _after_ the state has been changed.
|
379
382
|
|
380
383
|
@param [Object] val whether the object should be activated or deactivated. If the
|
381
384
|
object is a true value, the object will be activated, otherwise it will be deactivated
|
@@ -385,12 +388,42 @@ object is a true value, the object will be activated, otherwise it will be deact
|
|
385
388
|
old = @active
|
386
389
|
@active = val.to_bool
|
387
390
|
if old != @active
|
388
|
-
|
391
|
+
@active ? do_activation : do_deactivation
|
389
392
|
end
|
390
393
|
end
|
391
394
|
|
395
|
+
private
|
396
|
+
|
397
|
+
=begin rdoc
|
398
|
+
Method called after the state changes from active to inactive
|
399
|
+
|
400
|
+
It emits the @deactivated@ signal, if the class including the module has the signal.
|
401
|
+
|
402
|
+
Including classes can override this method to perform other actions every time the
|
403
|
+
object becomes inactive. In this case, they should call *super* if they want the
|
404
|
+
signal to be emitted
|
405
|
+
@return [nil]
|
406
|
+
=end
|
407
|
+
def do_deactivation
|
408
|
+
emit deactivated rescue NameError
|
409
|
+
end
|
410
|
+
|
411
|
+
=begin rdoc
|
412
|
+
Method called after the state changes from inactive to active
|
413
|
+
|
414
|
+
It emits the @activated@ signal, if the class including the module has the signal.
|
415
|
+
|
416
|
+
Including classes can override this method to perform other actions every time the
|
417
|
+
object becomes active. In this case, they should call *super* if they want the
|
418
|
+
signal to be emitted
|
419
|
+
@return [nil]
|
420
|
+
=end
|
421
|
+
def do_activation
|
422
|
+
emit activated rescue NameError
|
423
|
+
end
|
424
|
+
|
392
425
|
end
|
393
|
-
|
426
|
+
|
394
427
|
end
|
395
428
|
|
396
429
|
module Shellwords
|