ruber 0.0.5 → 0.0.7
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 +25 -0
- data/bin/ruber +0 -0
- data/data/share/apps/ruber/ruberui.rc +15 -1
- data/data/share/icons/{ruber.png → ruber-old.pgn} +0 -0
- data/lib/ruber/application/application.rb +216 -73
- data/lib/ruber/application/plugin.yaml +2 -2
- data/lib/ruber/document_project.rb +25 -5
- data/lib/ruber/documents/document_list.rb +11 -15
- data/lib/ruber/editor/document.rb +106 -50
- data/lib/ruber/editor/editor_view.rb +4 -2
- data/lib/ruber/external_program_plugin.rb +8 -0
- data/lib/ruber/kde_config_option_backend.rb +12 -4
- data/lib/ruber/kde_sugar.rb +35 -1
- data/lib/ruber/main_window/choose_plugins_dlg.rb +10 -10
- data/lib/ruber/main_window/hint_solver.rb +263 -0
- data/lib/ruber/main_window/main_window.rb +462 -206
- data/lib/ruber/main_window/main_window_actions.rb +228 -62
- data/lib/ruber/main_window/main_window_internal.rb +169 -115
- data/lib/ruber/main_window/plugin.yaml +13 -3
- data/lib/ruber/main_window/save_modified_files_dlg.rb +1 -1
- data/lib/ruber/main_window/ui/choose_plugins_widget.rb +1 -1
- data/lib/ruber/main_window/ui/main_window_settings_widget.rb +1 -1
- data/lib/ruber/main_window/ui/new_project_widget.rb +1 -1
- data/lib/ruber/main_window/ui/open_file_in_project_dlg.rb +1 -1
- data/lib/ruber/main_window/ui/output_color_widget.rb +1 -1
- data/lib/ruber/main_window/ui/workspace_settings_widget.rb +51 -0
- data/lib/ruber/main_window/ui/workspace_settings_widget.ui +28 -0
- data/lib/ruber/main_window/view_manager.rb +418 -0
- data/lib/ruber/main_window/workspace.png +0 -0
- data/lib/ruber/output_widget.rb +43 -37
- data/lib/ruber/pane.rb +621 -0
- data/lib/ruber/plugin_specification_reader.rb +8 -1
- data/lib/ruber/projects/project_files_list.rb +6 -0
- data/lib/ruber/projects/ui/project_files_rule_chooser_widget.rb +1 -1
- data/lib/ruber/projects/ui/project_files_widget.rb +1 -1
- data/lib/ruber/qt_sugar.rb +94 -4
- data/lib/ruber/utils.rb +16 -7
- data/lib/ruber/version.rb +2 -2
- data/plugins/autosave/autosave.rb +62 -1
- data/plugins/autosave/plugin.yaml +1 -0
- data/plugins/autosave/ui/autosave_config_widget.rb +37 -14
- data/plugins/autosave/ui/autosave_config_widget.ui +62 -12
- data/plugins/find_in_files/find_in_files_widgets.rb +1 -3
- data/plugins/find_in_files/ui/config_widget.rb +1 -1
- data/plugins/find_in_files/ui/find_in_files_widget.rb +1 -1
- data/plugins/rake/plugin.yaml +1 -1
- data/plugins/rake/ui/add_quick_task_widget.rb +1 -1
- data/plugins/rake/ui/choose_task_widget.rb +1 -1
- data/plugins/rake/ui/config_widget.rb +1 -1
- data/plugins/rake/ui/project_widget.rb +1 -1
- data/plugins/rspec/rspec.rb +14 -22
- data/plugins/rspec/ruber_rspec_formatter.rb +4 -1
- data/plugins/rspec/ui/rspec_project_widget.rb +1 -1
- data/plugins/ruby_development/plugin.yaml +7 -2
- data/plugins/ruby_development/ruby_development.rb +134 -13
- data/plugins/ruby_development/ui/config_widget.rb +66 -0
- data/plugins/ruby_development/ui/config_widget.ui +58 -0
- data/plugins/ruby_development/ui/project_widget.rb +1 -1
- data/plugins/ruby_runner/plugin.yaml +2 -2
- data/plugins/ruby_runner/ruby_runner.rb +15 -3
- data/plugins/ruby_runner/ui/config_widget.rb +1 -1
- data/plugins/ruby_runner/ui/project_widget.rb +1 -1
- data/plugins/ruby_runner/ui/ruby_runnner_plugin_option_widget.rb +1 -1
- data/plugins/state/plugin.yaml +6 -2
- data/plugins/state/state.rb +305 -81
- data/plugins/state/ui/config_widget.rb +1 -1
- data/spec/common.rb +11 -3
- data/spec/document_list_spec.rb +8 -8
- data/spec/document_project_spec.rb +98 -25
- data/spec/document_spec.rb +178 -152
- data/spec/editor_view_spec.rb +26 -5
- data/spec/framework.rb +5 -0
- data/spec/hint_solver_spec.rb +450 -0
- data/spec/kde_sugar_spec.rb +73 -6
- data/spec/output_widget_spec.rb +172 -156
- data/spec/pane_spec.rb +1165 -0
- data/spec/plugin_specification_reader_spec.rb +37 -1
- data/spec/project_files_list_spec.rb +30 -20
- data/spec/qt_sugar_spec.rb +269 -0
- data/spec/state_spec.rb +566 -353
- data/spec/utils_spec.rb +1 -1
- data/spec/view_manager_spec.rb +71 -0
- metadata +16 -4
|
@@ -5,7 +5,7 @@ class: 'Ruber::Application'
|
|
|
5
5
|
config_options:
|
|
6
6
|
:general:
|
|
7
7
|
:plugin_dirs: {:default: Ruber::Application::DEFAULT_PLUGIN_PATHS}
|
|
8
|
-
:plugins: {:default:
|
|
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"}
|
|
@@ -54,6 +54,7 @@ didn't exist. This means that it will be overwritten when the project is saved.
|
|
|
54
54
|
The reason for this behaviour is that there should be no user file in the directory
|
|
55
55
|
where document projects are saved.
|
|
56
56
|
=end
|
|
57
|
+
# $CALLED = 0
|
|
57
58
|
def initialize file
|
|
58
59
|
@old_files = []
|
|
59
60
|
begin super file_for(file)
|
|
@@ -127,12 +128,17 @@ will fail with an +ArgumentError+.
|
|
|
127
128
|
|
|
128
129
|
If the path of the file associated with the document changes (usually because of
|
|
129
130
|
a "Save As" action), the file associated with the backend is changed automatically
|
|
131
|
+
|
|
132
|
+
@todo in classes derived from Qt::Object, korundum executes the code in initialize,
|
|
133
|
+
up until the call to super twice. This means that two Backend items will be created.
|
|
134
|
+
See if something can be done to avoid it. I don't know whether this has any bad
|
|
135
|
+
consequence or not.
|
|
130
136
|
=end
|
|
131
137
|
def initialize doc
|
|
132
138
|
@document = doc
|
|
133
|
-
path =
|
|
139
|
+
path = backend_file
|
|
134
140
|
back = Backend.new path
|
|
135
|
-
back.
|
|
141
|
+
!File.exist?(back.file) ? super(doc, back, path) : super(doc, back)
|
|
136
142
|
connect doc, SIGNAL('document_url_changed(QObject*)'), self, SLOT(:change_file)
|
|
137
143
|
end
|
|
138
144
|
|
|
@@ -152,6 +158,8 @@ rule's scope includes +:document+
|
|
|
152
158
|
=end
|
|
153
159
|
def match_rule? obj
|
|
154
160
|
if !super then false
|
|
161
|
+
elsif !obj.place.include?(@document.url.local_file? ? :local : :remote)
|
|
162
|
+
false
|
|
155
163
|
elsif !@document.file_type_match? obj.mimetype, obj.file_extension then false
|
|
156
164
|
else true
|
|
157
165
|
end
|
|
@@ -170,7 +178,7 @@ directory if the document isn't associated with a file.
|
|
|
170
178
|
=begin rdoc
|
|
171
179
|
Override of <tt>AbstractProject#write</tt> which prevents a Errno::ENOENT exception
|
|
172
180
|
to be raised by the backend if the document isn't associated with a file. If the
|
|
173
|
-
|
|
181
|
+
document is associated with a file, however, the exception will be raised as usual.
|
|
174
182
|
|
|
175
183
|
The reason for this kind of behaviour is that the backend is expected to raise
|
|
176
184
|
the exception when the document isn't associated with a file: it simply means that
|
|
@@ -190,7 +198,12 @@ Override of AbstractProject#files which returns an array with the path of the
|
|
|
190
198
|
associated document, if it corresponds to a file, and an empty array otherwise
|
|
191
199
|
=end
|
|
192
200
|
def files
|
|
193
|
-
|
|
201
|
+
url = @document.url
|
|
202
|
+
if url.local_file?
|
|
203
|
+
path = url.path
|
|
204
|
+
else
|
|
205
|
+
path = url.to_encoded(Qt::Url::RemoveUserInfo|Qt::Url::RemovePort|Qt::Url::RemoveFragment).to_s
|
|
206
|
+
end
|
|
194
207
|
path.empty? ? [] : [path]
|
|
195
208
|
end
|
|
196
209
|
|
|
@@ -201,7 +214,14 @@ Updates the backend so that the associated file reflects the file associated wit
|
|
|
201
214
|
the document.
|
|
202
215
|
=end
|
|
203
216
|
def change_file
|
|
204
|
-
@backend.document_path =
|
|
217
|
+
@backend.document_path = backend_file
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
def backend_file
|
|
221
|
+
if @document.has_file?
|
|
222
|
+
@document.url.to_encoded(Qt::Url::RemoveUserInfo|Qt::Url::RemovePort|Qt::Url::RemoveFragment).to_s
|
|
223
|
+
else ''
|
|
224
|
+
end
|
|
205
225
|
end
|
|
206
226
|
|
|
207
227
|
end
|
|
@@ -94,9 +94,10 @@ the value of _create_if_needed_ a new document associated with the file or url
|
|
|
94
94
|
will be created. In this case, the {#document_created} signal will be emitted.
|
|
95
95
|
|
|
96
96
|
@param [String, KDE::Url] file the file name or URL associated with the document.
|
|
97
|
-
A relative file name will be expanded with respect to the current directory.
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
A relative file name will be expanded with respect to the current directory. A
|
|
98
|
+
string containing a url will be interpreted as an url, not as a filename. If you
|
|
99
|
+
need a document with a name which looks like an url, you can create an empty
|
|
100
|
+
@KDE::Url@, then using @path=@ to set its path
|
|
100
101
|
@param [Boolean] create_if_needed whether or not to create a document associated
|
|
101
102
|
with _file_ if there isn't one
|
|
102
103
|
@return [Document,nil] the document associated with _file_. If no such document
|
|
@@ -107,22 +108,17 @@ will be created. In this case, the {#document_created} signal will be emitted.
|
|
|
107
108
|
=end
|
|
108
109
|
def document file, create_if_needed = true
|
|
109
110
|
if file.is_a? String
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
elsif file.is_a? KDE::Url
|
|
114
|
-
doc = document_for_url file
|
|
115
|
-
return doc if doc or !create_if_needed
|
|
111
|
+
url = KDE::Url.new file
|
|
112
|
+
url.path = File.expand_path(file) if url.relative?
|
|
113
|
+
else url = file
|
|
116
114
|
end
|
|
115
|
+
doc = document_for_url file
|
|
116
|
+
return doc if doc or !create_if_needed
|
|
117
117
|
if !doc and create_if_needed
|
|
118
|
-
url = KDE::Url.new file
|
|
119
118
|
if url.local_file?
|
|
120
119
|
raise ArgumentError, "File #{url.path} doesn't exist" unless File.exist?(url.path)
|
|
121
120
|
end
|
|
122
|
-
doc = Document.new Ruber[:main_window],
|
|
123
|
-
begin @docs[0].close if @docs.only.pristine?
|
|
124
|
-
rescue IndexError
|
|
125
|
-
end
|
|
121
|
+
doc = Document.new Ruber[:main_window], url
|
|
126
122
|
add_document doc
|
|
127
123
|
emit document_created(doc)
|
|
128
124
|
end
|
|
@@ -227,8 +223,8 @@ The {#closing_document} signal is emitted before removing the document.
|
|
|
227
223
|
@return [nil]
|
|
228
224
|
=end
|
|
229
225
|
def close_document doc
|
|
230
|
-
emit closing_document(doc)
|
|
231
226
|
@docs.delete doc
|
|
227
|
+
emit closing_document(doc)
|
|
232
228
|
nil
|
|
233
229
|
end
|
|
234
230
|
private :close_document
|
|
@@ -40,13 +40,17 @@ module Ruber
|
|
|
40
40
|
def_delegator :@doc, :documentSave, :save_document
|
|
41
41
|
|
|
42
42
|
signal_data = {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
'text_changed' => ['KTextEditor::Document*', [nil]],
|
|
44
|
+
'about_to_close' => ['KTextEditor::Document*', [nil]],
|
|
45
|
+
'about_to_reload' => ['KTextEditor::Document*', [nil]],
|
|
46
|
+
'highlighting_mode_changed' => ['KTextEditor::Document*', [nil]],
|
|
47
|
+
'mode_changed' => ['KTextEditor::Document*', [nil]],
|
|
48
|
+
'sig_query_close' => ['bool*, bool*', [0,1]],
|
|
49
|
+
'canceled' => ['QString', [0]],
|
|
50
|
+
'started' => ['KIO::Job*', [0]],
|
|
51
|
+
'set_status_bar_text' => ['QString', [0]],
|
|
52
|
+
'setWindowCaption' => ['QString', [0]]
|
|
53
|
+
}
|
|
50
54
|
|
|
51
55
|
@signal_table = KTextEditorWrapper.prepare_wrapper_connections self, signal_data
|
|
52
56
|
|
|
@@ -56,17 +60,24 @@ module Ruber
|
|
|
56
60
|
'mode_changed(QObject*)', 'text_modified(KTextEditor::Range, KTextEditor::Range, QObject*)',
|
|
57
61
|
'text_inserted(KTextEditor::Range, QObject*)', 'text_removed(KTextEditor::Range, QObject*)',
|
|
58
62
|
'view_created(QObject*, QObject*)', 'closing(QObject*)', :activated, :deactivated,
|
|
59
|
-
'modified_on_disk(QObject*, bool, KTextEditor::ModificationInterface::ModifiedOnDiskReason)'
|
|
63
|
+
'modified_on_disk(QObject*, bool, KTextEditor::ModificationInterface::ModifiedOnDiskReason)',
|
|
64
|
+
'sig_query_close(bool*, bool*)', 'canceled(QString)', 'completed()', 'completed1(bool)',
|
|
65
|
+
'started(KIO::Job*)', 'set_status_bar_text(QString)', 'setWindowCaption(QString)'
|
|
60
66
|
|
|
61
|
-
slots :document_save_as, :save
|
|
62
|
-
|
|
63
67
|
=begin rdoc
|
|
64
|
-
|
|
68
|
+
Signal emitted before a view associated with the document is closed
|
|
69
|
+
|
|
70
|
+
When this signal is emitted, the view is still associated with the document, and
|
|
71
|
+
it is still included in the array returned by {#views}
|
|
72
|
+
@param [EditorView] view the view which is being closed
|
|
73
|
+
@param [Document] doc *self*
|
|
65
74
|
=end
|
|
66
|
-
|
|
75
|
+
signals 'closing_view(QWidget*, QObject*)'
|
|
76
|
+
|
|
77
|
+
slots :document_save_as, :save
|
|
67
78
|
|
|
68
79
|
def inspect
|
|
69
|
-
if disposed? then "< #{self.class} #{object_id}DISPOSED >"
|
|
80
|
+
if disposed? then "< #{self.class} #{object_id} DISPOSED >"
|
|
70
81
|
else super
|
|
71
82
|
end
|
|
72
83
|
end
|
|
@@ -79,7 +90,7 @@ Creates a new Ruber::Document.
|
|
|
79
90
|
@active = false
|
|
80
91
|
@doc = KTextEditor::EditorChooser.editor('katepart').create_document( self)
|
|
81
92
|
initialize_wrapper @doc, self.class.instance_variable_get(:@signal_table)
|
|
82
|
-
@
|
|
93
|
+
@views = []
|
|
83
94
|
@doc.openUrl(file.is_a?(String) ? KDE::Url.from_path(file) : file) if file
|
|
84
95
|
@annotation_model = AnnotationModel.new self
|
|
85
96
|
interface('annotation_interface').annotation_model = @annotation_model
|
|
@@ -90,8 +101,21 @@ Creates a new Ruber::Document.
|
|
|
90
101
|
@doc.connect(SIGNAL('modifiedChanged(KTextEditor::Document*)')) do |doc|
|
|
91
102
|
emit modified_changed(@doc.modified?, self)
|
|
92
103
|
end
|
|
93
|
-
@doc.connect(SIGNAL('
|
|
94
|
-
|
|
104
|
+
@doc.connect(SIGNAL('documentUrlChanged(KTextEditor::Document*)')) do |doc|
|
|
105
|
+
if !doc.url.remote_file?
|
|
106
|
+
Ruber[:components].each_component{|c| c.update_project @project}
|
|
107
|
+
end
|
|
108
|
+
emit document_url_changed self
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
@doc.connect SIGNAL(:completed) do
|
|
112
|
+
if @doc.url.remote_file?
|
|
113
|
+
Ruber[:components].each_component{|c|c.update_project @project}
|
|
114
|
+
end
|
|
115
|
+
emit completed
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
@doc.connect SIGNAL('documentNameChanged(KTextEditor::Document*)') do |doc|
|
|
95
119
|
emit document_name_changed doc.document_name, self
|
|
96
120
|
end
|
|
97
121
|
|
|
@@ -110,9 +134,34 @@ Creates a new Ruber::Document.
|
|
|
110
134
|
@modified_on_disk = (reason != KTextEditor::ModificationInterface::OnDiskUnmodified)
|
|
111
135
|
emit modified_on_disk(self, mod, reason)
|
|
112
136
|
end
|
|
137
|
+
connect @doc, SIGNAL('completed(bool)'), self, SIGNAL('completed1(bool)')
|
|
113
138
|
|
|
114
139
|
end
|
|
115
140
|
|
|
141
|
+
=begin rdoc
|
|
142
|
+
@return [Array<EditorView>] a list of the views assciated with the document
|
|
143
|
+
=end
|
|
144
|
+
def views
|
|
145
|
+
@views.dup
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
=begin rdoc
|
|
149
|
+
@return [Boolean] whether the document has at least one view associated with it
|
|
150
|
+
=end
|
|
151
|
+
def has_view?
|
|
152
|
+
!@views.empty?
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
=begin rdoc
|
|
156
|
+
The view which currently has user focus, if any
|
|
157
|
+
@return [EditorView,nil] the view associated with the document which currently has
|
|
158
|
+
user focus or *nil* if none of the views associated with the document has user
|
|
159
|
+
focus
|
|
160
|
+
=end
|
|
161
|
+
def active_view
|
|
162
|
+
@doc.active_view.parent rescue nil
|
|
163
|
+
end
|
|
164
|
+
|
|
116
165
|
=begin rdoc
|
|
117
166
|
Executes the action with name _name_ contained in document's view's action
|
|
118
167
|
collection. This is made by having the action emit the <tt>triggered()</tt> or
|
|
@@ -174,17 +223,39 @@ status of the document.
|
|
|
174
223
|
if @modified_on_disk then ICONS[:modified_on_disk]
|
|
175
224
|
elsif @doc.modified? then ICONS[:modified]
|
|
176
225
|
else
|
|
177
|
-
|
|
226
|
+
if has_file? :remote
|
|
227
|
+
mime = KDE::MimeType.find_by_content Qt::ByteArray.new(@doc.text)
|
|
228
|
+
else mime = KDE::MimeType.mime_type(@doc.mime_type)
|
|
229
|
+
end
|
|
230
|
+
icon_name = mime.icon_name
|
|
178
231
|
Qt::Icon.new(KDE::IconLoader.load_mime_type_pixmap icon_name)
|
|
179
232
|
end
|
|
180
233
|
end
|
|
181
234
|
|
|
182
235
|
=begin rdoc
|
|
183
|
-
|
|
184
|
-
|
|
236
|
+
Whether the document is associated with a file
|
|
237
|
+
|
|
238
|
+
Depending on the value of _which_ this method can also return *true* only if the
|
|
239
|
+
document is associated with a local file or with a remote file. In particular:
|
|
240
|
+
* if it's @:local@ this method will return *true* only if the document is associated
|
|
241
|
+
with a local file
|
|
242
|
+
* if it's @:remote@, this method will return *true* only if the document is associated
|
|
243
|
+
with a remote file
|
|
244
|
+
* with any other value, this method will return *true* if the document is associated
|
|
245
|
+
with any file
|
|
246
|
+
|
|
247
|
+
@param [Symbol, Object] which the kind of files which are acceptable
|
|
248
|
+
@return [Boolean] *true* if the document is associated with a file of the kind
|
|
249
|
+
matching _which_ and *false* otherwise
|
|
185
250
|
=end
|
|
186
|
-
def has_file?
|
|
187
|
-
|
|
251
|
+
def has_file? which = :any
|
|
252
|
+
u = url
|
|
253
|
+
return false if u.empty?
|
|
254
|
+
case which
|
|
255
|
+
when :local then url.local_file?
|
|
256
|
+
when :remote then !url.local_file?
|
|
257
|
+
else true
|
|
258
|
+
end
|
|
188
259
|
end
|
|
189
260
|
|
|
190
261
|
=begin rdoc
|
|
@@ -221,13 +292,6 @@ This method is associated with the Save menu entry
|
|
|
221
292
|
@project.save
|
|
222
293
|
res
|
|
223
294
|
end
|
|
224
|
-
# unless url.empty? then save_document
|
|
225
|
-
# else document_save_as
|
|
226
|
-
# res = KDE::FileDialog.get_save_file_name KDE::Url.new, "*.rb|Ruby files (*.rb)\n*|All files", nil,
|
|
227
|
-
# KDE::i18n("Save \"#{@doc.document_name}\" as")
|
|
228
|
-
# return false unless res
|
|
229
|
-
# save_as KDE::Url.from_path(res)
|
|
230
|
-
# end
|
|
231
295
|
end
|
|
232
296
|
|
|
233
297
|
=begin rdoc
|
|
@@ -235,20 +299,22 @@ Creats a view for the document. _parent_ is the view's parent widget. Raises
|
|
|
235
299
|
+RuntimeError+ if the document already has a view.
|
|
236
300
|
=end
|
|
237
301
|
def create_view parent = nil
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
@
|
|
241
|
-
|
|
242
|
-
@view.connect(SIGNAL('destroyed(QObject*)')){@view = nil}
|
|
243
|
-
gui = @view.send(:internal)
|
|
302
|
+
inner_view = @doc.create_view nil
|
|
303
|
+
view = EditorView.new self, inner_view, parent
|
|
304
|
+
@views << view
|
|
305
|
+
gui = view.send(:internal)
|
|
244
306
|
action = gui.action_collection.action('file_save_as')
|
|
245
307
|
disconnect action, SIGNAL(:triggered), @doc, SLOT('documentSaveAs()')
|
|
246
308
|
connect action, SIGNAL(:triggered), self, SLOT(:document_save_as)
|
|
247
309
|
action = gui.action_collection.action('file_save')
|
|
248
310
|
disconnect action, SIGNAL(:triggered), @doc, SLOT('documentSave()')
|
|
249
311
|
connect action, SIGNAL(:triggered), self, SLOT(:save)
|
|
250
|
-
|
|
251
|
-
|
|
312
|
+
view.connect(SIGNAL('closing(QWidget*)')) do |v|
|
|
313
|
+
emit closing_view v, self
|
|
314
|
+
@views.delete v
|
|
315
|
+
end
|
|
316
|
+
emit view_created(view, self)
|
|
317
|
+
view
|
|
252
318
|
end
|
|
253
319
|
|
|
254
320
|
=begin rdoc
|
|
@@ -261,7 +327,7 @@ Return the project with wider scope the document belongs to. This is:
|
|
|
261
327
|
def project
|
|
262
328
|
prj = Ruber[:projects].current
|
|
263
329
|
return @project if path.empty? or !prj
|
|
264
|
-
prj.project_files.file_in_project?(
|
|
330
|
+
prj.project_files.file_in_project?(url.to_encoded.to_s) ? prj : @project
|
|
265
331
|
end
|
|
266
332
|
|
|
267
333
|
=begin rdoc
|
|
@@ -324,26 +390,16 @@ TODO: maybe remove the argument, since this method is not called anymore at
|
|
|
324
390
|
if !ask || query_close
|
|
325
391
|
emit closing(self)
|
|
326
392
|
@project.save unless path.empty?
|
|
327
|
-
@
|
|
393
|
+
@views.dup.each{|v| v.close}
|
|
328
394
|
return false unless close_url false
|
|
329
395
|
@project.close false
|
|
396
|
+
delete_later
|
|
330
397
|
self.disconnect
|
|
331
|
-
dispose
|
|
332
398
|
true
|
|
333
399
|
else false
|
|
334
400
|
end
|
|
335
401
|
end
|
|
336
|
-
|
|
337
|
-
=begin rdoc
|
|
338
|
-
Closes the view _view_ associated with the document.
|
|
339
|
-
|
|
340
|
-
Currently, the _view_ parameter is unused, as a document can only have one view,
|
|
341
|
-
and all this method does is to call the <tt>close</tt> method with _ask_ as argument.
|
|
342
|
-
=end
|
|
343
|
-
def close_view view, ask = true
|
|
344
|
-
close ask
|
|
345
|
-
end
|
|
346
|
-
|
|
402
|
+
|
|
347
403
|
=begin rdoc
|
|
348
404
|
The <tt>KParts::Part</tt> associated with the document
|
|
349
405
|
=end
|
|
@@ -42,7 +42,7 @@ module Ruber
|
|
|
42
42
|
|
|
43
43
|
@signal_table = KTextEditorWrapper.prepare_wrapper_connections self, signal_data
|
|
44
44
|
|
|
45
|
-
signals 'closing()', 'cursor_position_changed(KTextEditor::Cursor, QWidget*)',
|
|
45
|
+
signals 'closing(QWidget*)', 'cursor_position_changed(KTextEditor::Cursor, QWidget*)',
|
|
46
46
|
'view_mode_changed(QString, QWidget*)', 'edit_mode_changed(KTextEditor::View::EditMode, QWidget*)',
|
|
47
47
|
'selection_mode_changed(bool, QWidget*)', 'mouse_position_changed(KTextEditor::Cursor, QWidget*)',
|
|
48
48
|
'selection_changed(QWidget*)'
|
|
@@ -71,6 +71,7 @@ module Ruber
|
|
|
71
71
|
alias_method :document, :doc
|
|
72
72
|
def initialize doc, internal, parent = nil
|
|
73
73
|
super parent
|
|
74
|
+
set_attribute Qt::WA_DeleteOnClose, true
|
|
74
75
|
@block_selection = false
|
|
75
76
|
@doc = doc
|
|
76
77
|
@view = internal
|
|
@@ -124,8 +125,9 @@ module Ruber
|
|
|
124
125
|
end
|
|
125
126
|
|
|
126
127
|
def close
|
|
127
|
-
emit closing
|
|
128
|
+
emit closing self
|
|
128
129
|
super
|
|
130
|
+
# delete_later
|
|
129
131
|
end
|
|
130
132
|
|
|
131
133
|
def set_annotation_border_visible vis
|
|
@@ -265,6 +265,9 @@ want to call *super*)
|
|
|
265
265
|
_lines_ is an array where each entry corresponds to a line of output from the
|
|
266
266
|
program. If buffering is on, each entry is a complete line (or should be considered
|
|
267
267
|
such). If buffering is off, you'll have to take care of newlines by yourself.
|
|
268
|
+
|
|
269
|
+
@param [Array<String>] lines the output lines
|
|
270
|
+
@return [nil]
|
|
268
271
|
=end
|
|
269
272
|
def process_standard_output lines
|
|
270
273
|
return unless @output_widget
|
|
@@ -276,6 +279,7 @@ such). If buffering is off, you'll have to take care of newlines by yourself.
|
|
|
276
279
|
mod.set_data idx, Qt::Variant.new(l)
|
|
277
280
|
@output_widget.set_output_type idx, :output
|
|
278
281
|
end
|
|
282
|
+
nil
|
|
279
283
|
end
|
|
280
284
|
|
|
281
285
|
=begin rdoc
|
|
@@ -290,6 +294,9 @@ want to call *super*)
|
|
|
290
294
|
_lines_ is an array where each entry corresponds to a line of output from the
|
|
291
295
|
program. If buffering is on, each entry is a complete line (or should be considered
|
|
292
296
|
such). If buffering is off, you'll have to take care of newlines by yourself.
|
|
297
|
+
|
|
298
|
+
@param [Array<String>] lines the lines on standard error
|
|
299
|
+
@return [nil]
|
|
293
300
|
=end
|
|
294
301
|
def process_standard_error lines
|
|
295
302
|
return unless @output_widget
|
|
@@ -301,6 +308,7 @@ such). If buffering is off, you'll have to take care of newlines by yourself.
|
|
|
301
308
|
mod.set_data idx, Qt::Variant.new(l)
|
|
302
309
|
@output_widget.set_output_type idx, :error
|
|
303
310
|
end
|
|
311
|
+
nil
|
|
304
312
|
end
|
|
305
313
|
|
|
306
314
|
=begin rdoc
|
|
@@ -89,8 +89,12 @@ default value will be returned
|
|
|
89
89
|
return opt.default.deep_copy unless grp.has_key(humanize(opt.name))
|
|
90
90
|
if @yaml_options.include? [opt.group, opt.name] or !recognized_value?(opt.default)
|
|
91
91
|
YAML.load grp.read_entry humanize(opt.name), ''
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
else
|
|
93
|
+
#Uncomment the following lines if the state/open_projects is read as a string
|
|
94
|
+
# begin grp.read_entry humanize(opt.name), opt.default
|
|
95
|
+
# rescue ArgumentError
|
|
96
|
+
(grp.read_entry humanize(opt.name), Qt::Variant.from_value(opt.default)).value
|
|
97
|
+
# end
|
|
94
98
|
end
|
|
95
99
|
end
|
|
96
100
|
|
|
@@ -114,8 +118,12 @@ and on file.
|
|
|
114
118
|
elsif need_yaml? opt, value
|
|
115
119
|
@config.group(humanize(opt.group)).write_entry(humanize(opt.name), YAML.dump(value))
|
|
116
120
|
@yaml_options << [opt.group, opt.name]
|
|
117
|
-
|
|
118
|
-
|
|
121
|
+
else
|
|
122
|
+
#Uncomment the following lines if the state/open_projects is written as a string
|
|
123
|
+
# begin @config.group(humanize(opt.group)).write_entry(humanize(opt.name), value)
|
|
124
|
+
# rescue ArgumentError
|
|
125
|
+
@config.group(humanize(opt.group)).write_entry(humanize(opt.name), Qt::Variant.from_value(value))
|
|
126
|
+
# end
|
|
119
127
|
end
|
|
120
128
|
end
|
|
121
129
|
@yaml_options.uniq!
|