[gedit-plugins/gnome-2-32] Remove trailing spaces
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-plugins/gnome-2-32] Remove trailing spaces
- Date: Sun, 29 Aug 2010 22:54:03 +0000 (UTC)
commit fd9c93409b8818df9c2cf7578323afd5a2bdf1ba
Author: Jesse van den Kieboom <jesse icecrew nl>
Date: Mon Aug 30 00:43:42 2010 +0200
Remove trailing spaces
plugins/bookmarks/gedit-bookmarks-plugin.c | 172 ++++++++++----------
plugins/bookmarks/gedit-bookmarks-plugin.h | 2 +-
plugins/bracketcompletion/bracketcompletion.py | 38 +++---
plugins/charmap/gedit-charmap-panel.c | 6 +-
plugins/charmap/gedit-charmap-panel.h | 4 +-
plugins/charmap/gedit-charmap-plugin.c | 30 ++--
plugins/charmap/gedit-charmap-plugin.h | 2 +-
plugins/colorpicker/colorpicker.py | 16 +-
plugins/commander/commander/__init__.py | 10 +-
plugins/commander/commander/commands/__init__.py | 104 ++++++------
plugins/commander/commander/commands/completion.py | 60 ++++----
plugins/commander/commander/commands/exceptions.py | 2 +-
plugins/commander/commander/commands/method.py | 22 ++--
plugins/commander/commander/commands/module.py | 40 +++---
plugins/commander/commander/commands/result.py | 8 +-
.../commander/commands/rollbackimporter.py | 14 +-
plugins/commander/commander/entry.py | 134 ++++++++--------
plugins/commander/commander/history.py | 22 ++--
plugins/commander/commander/info.py | 152 +++++++++---------
plugins/commander/commander/transparentwindow.py | 18 +-
plugins/commander/commander/utils.py | 8 +-
plugins/commander/commander/windowhelper.py | 6 +-
plugins/commander/modules/doc.py | 84 +++++-----
plugins/commander/modules/edit.py | 64 ++++----
plugins/commander/modules/find/__init__.py | 8 +-
plugins/commander/modules/find/finder.py | 90 +++++-----
plugins/commander/modules/find/regex.py | 28 ++--
plugins/commander/modules/find/test.py | 18 +-
plugins/commander/modules/goto.py | 2 +-
plugins/commander/modules/help.py | 8 +-
plugins/commander/modules/move.py | 22 ++--
plugins/commander/modules/reload.py | 6 +-
plugins/commander/modules/set.py | 24 ++--
plugins/commander/modules/shell.py | 46 +++---
plugins/drawspaces/gedit-drawspaces-plugin.c | 116 +++++++-------
plugins/drawspaces/gedit-drawspaces-plugin.h | 4 +-
plugins/joinlines/joinlines.py | 34 ++--
plugins/multiedit/multiedit/__init__.py | 10 +-
plugins/multiedit/multiedit/constants.py | 8 +-
plugins/multiedit/multiedit/documenthelper.py | 110 +++++++-------
plugins/multiedit/multiedit/signals.py | 42 +++---
plugins/multiedit/multiedit/windowhelper.py | 28 ++--
plugins/sessionsaver/__init__.py | 6 +-
plugins/sessionsaver/dialogs.py | 4 +-
plugins/sessionsaver/store.py | 16 +-
plugins/showtabbar/gedit-show-tabbar-plugin.c | 44 +++---
plugins/showtabbar/gedit-show-tabbar-plugin.h | 2 +-
plugins/smartspaces/smartspaces.py | 28 ++--
.../wordcompletion/gedit-word-completion-plugin.c | 24 ++--
.../wordcompletion/gedit-word-completion-plugin.h | 2 +-
50 files changed, 874 insertions(+), 874 deletions(-)
---
diff --git a/plugins/bookmarks/gedit-bookmarks-plugin.c b/plugins/bookmarks/gedit-bookmarks-plugin.c
index c483469..835f83b 100644
--- a/plugins/bookmarks/gedit-bookmarks-plugin.c
+++ b/plugins/bookmarks/gedit-bookmarks-plugin.c
@@ -1,13 +1,13 @@
/*
* gedit-bookmarks-plugin.c - Bookmarking for gedit
- *
+ *
* Copyright (C) 2008 Jesse van den Kieboom
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -82,17 +82,17 @@ static void on_begin_user_action (GtkTextBuffer *buffer,
static void on_end_user_action (GtkTextBuffer *buffer,
InsertData *data);
-static void on_toggle_bookmark_activate (GtkAction *action,
+static void on_toggle_bookmark_activate (GtkAction *action,
GeditWindow *window);
-static void on_next_bookmark_activate (GtkAction *action,
+static void on_next_bookmark_activate (GtkAction *action,
GeditWindow *window);
-static void on_previous_bookmark_activate (GtkAction *action,
+static void on_previous_bookmark_activate (GtkAction *action,
GeditWindow *window);
-static void on_tab_added (GeditWindow *window,
- GeditTab *tab,
+static void on_tab_added (GeditWindow *window,
+ GeditTab *tab,
GeditPlugin *plugin);
-static void on_tab_removed (GeditWindow *window,
- GeditTab *tab,
+static void on_tab_removed (GeditWindow *window,
+ GeditTab *tab,
GeditPlugin *plugin);
static void add_bookmark (GtkSourceBuffer *buffer, GtkTextIter *iter);
@@ -135,7 +135,7 @@ free_insert_data (InsertData *data)
static GtkActionEntry const action_entries[] = {
{"ToggleBookmark", NULL, N_("Toggle Bookmark"), "<Control><Alt>B",
- N_("Toggle bookmark status of the current line"),
+ N_("Toggle bookmark status of the current line"),
G_CALLBACK (on_toggle_bookmark_activate)},
{"NextBookmark", NULL, N_("Goto Next Bookmark"), "<Control>B",
N_("Goto the next bookmark"),
@@ -167,18 +167,18 @@ install_menu (GeditWindow *window)
manager = gedit_window_get_ui_manager (window);
data->action_group = gtk_action_group_new ("GeditBookmarksPluginActions");
-
+
gtk_action_group_set_translation_domain (data->action_group,
GETTEXT_PACKAGE);
-
- gtk_action_group_add_actions (data->action_group,
+
+ gtk_action_group_add_actions (data->action_group,
action_entries,
G_N_ELEMENTS (action_entries),
window);
-
+
gtk_ui_manager_insert_action_group (manager, data->action_group, -1);
data->ui_id = gtk_ui_manager_add_ui_from_string (manager, uidefinition, -1, &error);
-
+
if (!data->ui_id)
{
g_warning ("Could not load UI: %s", error->message);
@@ -191,12 +191,12 @@ uninstall_menu (GeditWindow *window)
{
WindowData *data = BOOKMARKS_DATA (window);
GtkUIManager *manager;
-
+
manager = gedit_window_get_ui_manager (window);
-
+
gtk_ui_manager_remove_ui (manager, data->ui_id);
gtk_ui_manager_remove_action_group (manager, data->action_group);
-
+
g_object_unref (data->action_group);
}
@@ -207,24 +207,24 @@ disable_bookmarks (GeditView *view)
GtkTextIter end;
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gpointer data;
-
+
gtk_source_view_set_show_line_marks (GTK_SOURCE_VIEW (view), FALSE);
gtk_text_buffer_get_bounds (buffer, &start, &end);
- gtk_source_buffer_remove_source_marks (GTK_SOURCE_BUFFER (buffer),
- &start,
- &end,
+ gtk_source_buffer_remove_source_marks (GTK_SOURCE_BUFFER (buffer),
+ &start,
+ &end,
BOOKMARK_CATEGORY);
g_signal_handlers_disconnect_by_func (buffer, on_style_scheme_notify, view);
g_signal_handlers_disconnect_by_func (buffer, on_delete_range, NULL);
-
+
data = g_object_get_data (G_OBJECT (buffer), INSERT_DATA_KEY);
g_signal_handlers_disconnect_by_func (buffer, on_insert_text_before, data);
g_signal_handlers_disconnect_by_func (buffer, on_begin_user_action, data);
g_signal_handlers_disconnect_by_func (buffer, on_end_user_action, data);
-
+
g_object_set_data (G_OBJECT (buffer), INSERT_DATA_KEY, NULL);
}
@@ -266,7 +266,7 @@ enable_bookmarks (GeditView *view,
g_object_unref (pixbuf);
gtk_source_view_set_show_line_marks (GTK_SOURCE_VIEW (view), TRUE);
-
+
g_signal_connect (buffer,
"notify::style-scheme",
G_CALLBACK (on_style_scheme_notify),
@@ -276,11 +276,11 @@ enable_bookmarks (GeditView *view,
"delete-range",
G_CALLBACK (on_delete_range),
NULL);
-
+
data = g_slice_new0 (InsertData);
-
- g_object_set_data_full (G_OBJECT (buffer),
- INSERT_DATA_KEY,
+
+ g_object_set_data_full (G_OBJECT (buffer),
+ INSERT_DATA_KEY,
data,
(GDestroyNotify) free_insert_data);
@@ -314,28 +314,28 @@ load_bookmarks (GeditView *view,
GtkTextIter iter;
gint tot_lines;
gint i;
-
+
buf = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
-
+
gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (buf), &iter);
tot_lines = gtk_text_iter_get_line (&iter);
-
+
for (i = 0; bookmarks != NULL && bookmarks[i] != NULL; i++)
{
gint line;
-
+
line = atoi (bookmarks[i]);
if (line >= 0 && line < tot_lines)
{
GSList *marks;
-
+
gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (buf),
&iter, line);
-
+
marks = gtk_source_buffer_get_source_marks_at_iter (buf, &iter,
BOOKMARK_CATEGORY);
-
+
if (marks == NULL)
{
/* Add new bookmark */
@@ -364,7 +364,7 @@ load_bookmark_metadata (GeditView *view)
if (bookmarks_attr != NULL)
{
gchar **bookmarks;
-
+
bookmarks = g_strsplit (bookmarks_attr, ",", -1);
g_free (bookmarks_attr);
@@ -419,20 +419,20 @@ goto_bookmark (GeditWindow *window,
if (!func (GTK_SOURCE_BUFFER (buffer), &at, BOOKMARK_CATEGORY))
{
GSList *marks;
-
+
/* cycle through */
cycle_func (buffer, &at);
gtk_text_iter_set_line_offset (&at, 0);
-
+
marks = gtk_source_buffer_get_source_marks_at_iter (GTK_SOURCE_BUFFER (buffer),
&at,
BOOKMARK_CATEGORY);
-
+
if (!marks && !func (GTK_SOURCE_BUFFER (buffer), &at, BOOKMARK_CATEGORY))
{
return;
}
-
+
g_slist_free (marks);
}
@@ -465,12 +465,12 @@ message_get_view_iter (GeditWindow *window,
{
*view = GTK_SOURCE_VIEW (gedit_window_get_active_view (window));
}
-
+
if (!*view)
{
return;
}
-
+
if (gedit_message_has_key (message, "iter"))
{
gedit_message_get (message, "iter", iter, NULL);
@@ -493,12 +493,12 @@ message_toggle_cb (GeditMessageBus *bus,
GtkTextIter iter;
message_get_view_iter (window, message, &view, &iter);
-
+
if (!view)
{
return;
}
-
+
toggle_bookmark (GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))),
&iter);
}
@@ -512,12 +512,12 @@ message_add_cb (GeditMessageBus *bus,
GtkTextIter iter;
message_get_view_iter (window, message, &view, &iter);
-
+
if (!view)
{
return;
}
-
+
add_bookmark (GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))),
&iter);
}
@@ -531,12 +531,12 @@ message_remove_cb (GeditMessageBus *bus,
GtkTextIter iter;
message_get_view_iter (window, message, &view, &iter);
-
+
if (!view)
{
return;
}
-
+
remove_bookmark (GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))),
&iter);
}
@@ -550,7 +550,7 @@ message_goto_next_cb (GeditMessageBus *bus,
GtkTextIter iter;
message_get_view_iter (window, message, &view, &iter);
-
+
if (!view)
{
return;
@@ -572,7 +572,7 @@ message_goto_previous_cb (GeditMessageBus *bus,
GtkTextIter iter;
message_get_view_iter (window, message, &view, &iter);
-
+
if (!view)
{
return;
@@ -589,7 +589,7 @@ static void
install_messages (GeditWindow *window)
{
GeditMessageBus *bus = gedit_window_get_message_bus (window);
-
+
gedit_message_bus_register (bus,
MESSAGE_OBJECT_PATH,
"toggle",
@@ -659,7 +659,7 @@ impl_activate (GeditPlugin *plugin,
WINDOW_DATA_KEY,
data,
(GDestroyNotify) free_window_data);
-
+
views = gedit_window_get_views (window);
for (item = views; item != NULL; item = item->next)
{
@@ -689,19 +689,19 @@ save_bookmark_metadata (GeditView *view)
gboolean first = TRUE;
buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
-
+
gtk_text_buffer_get_start_iter (buf, &iter);
-
+
string = g_string_new (NULL);
-
+
while (gtk_source_buffer_forward_iter_to_source_mark (GTK_SOURCE_BUFFER (buf),
&iter,
BOOKMARK_CATEGORY))
{
gint line;
-
+
line = gtk_text_iter_get_line (&iter);
-
+
if (!first)
{
g_string_append_printf (string, ",%d", line);
@@ -720,7 +720,7 @@ save_bookmark_metadata (GeditView *view)
}
else
val = g_string_free (string, FALSE);
-
+
gedit_document_set_metadata (GEDIT_DOCUMENT (buf), METADATA_ATTR,
val, NULL);
@@ -739,19 +739,19 @@ impl_deactivate (GeditPlugin *plugin,
uninstall_menu (window);
uninstall_messages (window);
-
+
views = gedit_window_get_views (window);
for (item = views; item != NULL; item = item->next)
{
disable_bookmarks (GEDIT_VIEW (item->data));
}
-
+
g_list_free (views);
-
+
data = BOOKMARKS_DATA (window);
g_return_if_fail (data != NULL);
-
+
g_signal_handlers_disconnect_by_func (window, on_tab_added, plugin);
g_signal_handlers_disconnect_by_func (window, on_tab_removed, plugin);
@@ -777,19 +777,19 @@ update_background_color (GeditView *view)
GtkSourceStyle *style;
GtkSourceStyleScheme *scheme;
GtkTextBuffer *buffer;
-
+
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
-
+
scheme = gtk_source_buffer_get_style_scheme (GTK_SOURCE_BUFFER (buffer));
style = gtk_source_style_scheme_get_style (scheme, "search-match");
-
+
if (style)
{
gboolean bgset;
gchar *bg;
-
+
g_object_get (style, "background-set", &bgset, "background", &bg, NULL);
-
+
if (bgset)
{
GdkColor color;
@@ -798,17 +798,17 @@ update_background_color (GeditView *view)
BOOKMARK_CATEGORY,
&color);
g_free (bg);
-
+
return;
}
}
-
+
gtk_source_view_set_mark_category_background (source_view,
BOOKMARK_CATEGORY,
NULL);
}
-static void
+static void
on_style_scheme_notify (GObject *object,
GParamSpec *pspec,
GeditView *view)
@@ -816,7 +816,7 @@ on_style_scheme_notify (GObject *object,
update_background_color (view);
}
-static void
+static void
on_delete_range (GtkTextBuffer *buffer,
GtkTextIter *start,
GtkTextIter *end,
@@ -827,18 +827,18 @@ on_delete_range (GtkTextBuffer *buffer,
GSList *item;
iter = *start;
-
+
/* move to start of line */
gtk_text_iter_set_line_offset (&iter, 0);
-
+
/* remove any bookmarks that are collapsed on each other due to this */
- marks = gtk_source_buffer_get_source_marks_at_iter (GTK_SOURCE_BUFFER (buffer),
+ marks = gtk_source_buffer_get_source_marks_at_iter (GTK_SOURCE_BUFFER (buffer),
&iter,
BOOKMARK_CATEGORY);
if (marks == NULL)
return;
-
+
/* remove all but the first mark */
for (item = marks->next; item; item = item->next)
gtk_text_buffer_delete_mark (buffer, GTK_TEXT_MARK (item->data));
@@ -925,7 +925,7 @@ add_tracker (GtkTextBuffer *buffer,
data->trackers = g_slist_prepend (data->trackers, tracker);
}
-static void
+static void
on_insert_text_before (GtkTextBuffer *buffer,
GtkTextIter *location,
gchar *text,
@@ -968,8 +968,8 @@ get_bookmark_and_iter (GtkSourceBuffer *buffer,
gtk_text_iter_set_line_offset (start, 0);
- marks = gtk_source_buffer_get_source_marks_at_iter (buffer,
- start,
+ marks = gtk_source_buffer_get_source_marks_at_iter (buffer,
+ start,
BOOKMARK_CATEGORY);
if (marks != NULL)
@@ -1008,9 +1008,9 @@ add_bookmark (GtkSourceBuffer *buffer,
if (bookmark == NULL)
{
- gtk_source_buffer_create_source_mark (GTK_SOURCE_BUFFER (buffer),
- NULL,
- BOOKMARK_CATEGORY,
+ gtk_source_buffer_create_source_mark (GTK_SOURCE_BUFFER (buffer),
+ NULL,
+ BOOKMARK_CATEGORY,
&start);
}
}
@@ -1023,7 +1023,7 @@ toggle_bookmark (GtkSourceBuffer *buffer,
GtkSourceMark *bookmark = NULL;
bookmark = get_bookmark_and_iter (buffer, iter, &start);
-
+
if (bookmark != NULL)
{
remove_bookmark (buffer, &start);
@@ -1031,7 +1031,7 @@ toggle_bookmark (GtkSourceBuffer *buffer,
else
{
add_bookmark (buffer, &start);
- }
+ }
}
static void
@@ -1096,7 +1096,7 @@ on_tab_added (GeditWindow *window,
doc = gedit_tab_get_document (tab);
view = gedit_tab_get_view (tab);
-
+
g_signal_connect (doc, "loaded",
G_CALLBACK (on_document_loaded),
view);
@@ -1117,7 +1117,7 @@ on_tab_removed (GeditWindow *window,
doc = gedit_tab_get_document (tab);
view = gedit_tab_get_view (tab);
-
+
g_signal_handlers_disconnect_by_func (doc, on_document_loaded, view);
g_signal_handlers_disconnect_by_func (doc, on_document_saved, view);
diff --git a/plugins/bookmarks/gedit-bookmarks-plugin.h b/plugins/bookmarks/gedit-bookmarks-plugin.h
index 660285e..82b874b 100644
--- a/plugins/bookmarks/gedit-bookmarks-plugin.h
+++ b/plugins/bookmarks/gedit-bookmarks-plugin.h
@@ -1,6 +1,6 @@
/*
* gedit-advancedediting-plugin.h - Advanced editing for gedit
- *
+ *
* Copyright (C) 2008 Jesse van den Kieboom
*
* This program is free software; you can redistribute it and/or modify
diff --git a/plugins/bracketcompletion/bracketcompletion.py b/plugins/bracketcompletion/bracketcompletion.py
index da77756..3dbf4ae 100644
--- a/plugins/bracketcompletion/bracketcompletion.py
+++ b/plugins/bracketcompletion/bracketcompletion.py
@@ -1,19 +1,19 @@
# -*- coding: utf-8 -*-
#
# bracketcompletion.py - Bracket completion plugin for gedit
-#
+#
# Copyright (C) 2006 - Steve Frécinaux
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330,
@@ -55,7 +55,7 @@ class BracketCompletionViewHelper(object):
self._stack = []
self._relocate_marks = True
self.update_language()
-
+
#Add the markers to the buffer
insert = self._doc.get_iter_at_mark(self._doc.get_insert())
self._mark_begin = self._doc.create_mark(None, insert, True)
@@ -199,10 +199,10 @@ class BracketCompletionViewHelper(object):
if event.keyval == gtk.keysyms.BackSpace:
self._stack = []
-
+
if self._last_iter == None:
return False
-
+
iter = self._doc.get_iter_at_mark(self._doc.get_insert())
iter.backward_char()
self._doc.begin_user_action()
@@ -221,7 +221,7 @@ class BracketCompletionViewHelper(object):
indent = self.compute_indentation(iter)
indent = "\n" + indent
-
+
# Insert new line and auto-indent.
self._doc.begin_user_action()
self._doc.insert(iter, indent)
@@ -244,7 +244,7 @@ class BracketCompletionViewHelper(object):
event.state & (gdk.CONTROL_MASK | gdk.MOD1_MASK) or \
event.keyval not in self._bracket_keyvals:
return
-
+
# Check if the insert mark is in the range of mark_begin to mark_end
# if not we free the stack
insert = self._doc.get_insert()
@@ -255,10 +255,10 @@ class BracketCompletionViewHelper(object):
if not insert_iter.in_range(iter_begin, iter_end):
self._stack = []
self._relocate_marks = True
-
+
# Check if the word is not in our brackets
word, start, end = self.get_current_token()
-
+
if word not in self._brackets and word not in close_brackets:
return
@@ -268,20 +268,20 @@ class BracketCompletionViewHelper(object):
self._doc.move_mark(self._mark_begin, insert_iter)
self._doc.move_mark(self._mark_end, insert_iter)
self._relocate_marks = False
-
+
# Depending on having close bracket or a open bracket we get the opposed
# bracket
bracket = None
bracket2 = None
-
+
if word not in close_brackets:
self._stack.append(word)
bracket = self._brackets[word]
else:
bracket2 = close_brackets[word]
-
+
word2, start2, end2 = self.get_next_token()
-
+
# Check to skip the closing bracket
# Example: word = ) and word2 = )
if word == word2:
@@ -294,13 +294,13 @@ class BracketCompletionViewHelper(object):
end.forward_char()
self._doc.place_cursor(end)
return
-
+
# Insert the closing bracket
if bracket != None:
self._doc.begin_user_action()
self._doc.insert(end, bracket)
self._doc.end_user_action()
-
+
# Leave the cursor when we want it to be
self._last_iter = end.copy()
end.backward_chars(len(bracket))
@@ -319,11 +319,11 @@ class BracketCompletionPlugin(gedit.Plugin):
def add_helper(self, view):
helper = BracketCompletionViewHelper(view)
view.set_data(self.VIEW_DATA_KEY, helper)
-
+
def remove_helper(self, view):
view.get_data(self.VIEW_DATA_KEY).deactivate()
view.set_data(self.VIEW_DATA_KEY, None)
-
+
def activate(self, window):
for view in window.get_views():
self.add_helper(view)
diff --git a/plugins/charmap/gedit-charmap-panel.c b/plugins/charmap/gedit-charmap-panel.c
index 2cc621b..d9fc0e0 100644
--- a/plugins/charmap/gedit-charmap-panel.c
+++ b/plugins/charmap/gedit-charmap-panel.c
@@ -1,13 +1,13 @@
/*
* gedit-charmap-panel.c
- *
+ *
* Copyright (C) 2006 Steve Frécinaux
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -110,7 +110,7 @@ gedit_charmap_panel_init (GeditCharmapPanel *panel)
gucharmap_chapters_view_select_locale (priv->chapters_view);
gtk_paned_set_position (paned, 150);
-
+
gtk_box_pack_start (GTK_BOX (panel), GTK_WIDGET (paned), TRUE, TRUE, 0);
}
diff --git a/plugins/charmap/gedit-charmap-panel.h b/plugins/charmap/gedit-charmap-panel.h
index e5ba15b..9dca838 100644
--- a/plugins/charmap/gedit-charmap-panel.h
+++ b/plugins/charmap/gedit-charmap-panel.h
@@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU General Public License
* along with gedit; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
@@ -52,7 +52,7 @@ typedef struct _GeditCharmapPanel GeditCharmapPanel;
struct _GeditCharmapPanel
{
GtkVBox parent_instance;
-
+
/*< private > */
GeditCharmapPanelPrivate *priv;
};
diff --git a/plugins/charmap/gedit-charmap-plugin.c b/plugins/charmap/gedit-charmap-plugin.c
index ab11953..80afb5b 100644
--- a/plugins/charmap/gedit-charmap-plugin.c
+++ b/plugins/charmap/gedit-charmap-plugin.c
@@ -1,13 +1,13 @@
/*
* gedit-charmap-plugin.c - Character map side-pane for gedit
- *
+ *
* Copyright (C) 2006 Steve Frécinaux
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -103,7 +103,7 @@ on_table_sync_active_char (GucharmapChartable *chartable,
wc = gucharmap_chartable_get_active_character (chartable);
gs = g_string_new (NULL);
- g_string_append_printf (gs, "U+%4.4X %s", wc,
+ g_string_append_printf (gs, "U+%4.4X %s", wc,
gucharmap_get_unicode_name (wc));
temps = gucharmap_get_nameslist_equals (wc);
@@ -135,7 +135,7 @@ on_table_focus_out_event (GtkWidget *drawing_area,
{
GucharmapChartable *chartable;
WindowData *data;
-
+
data = (WindowData *) g_object_get_data (G_OBJECT (window),
WINDOW_DATA_KEY);
g_return_val_if_fail (data != NULL, FALSE);
@@ -159,28 +159,28 @@ on_table_activate (GucharmapChartable *chartable,
gunichar wc;
wc = gucharmap_chartable_get_active_character (chartable);
-
+
g_return_if_fail (gucharmap_unichar_validate (wc));
-
+
view = GTK_TEXT_VIEW (gedit_window_get_active_view (window));
-
+
if (!view || !gtk_text_view_get_editable (view))
return;
-
+
document = gtk_text_view_get_buffer (view);
-
+
g_return_if_fail (document != NULL);
-
+
length = g_unichar_to_utf8 (wc, buffer);
gtk_text_buffer_begin_user_action (document);
-
+
gtk_text_buffer_get_selection_bounds (document, &start, &end);
gtk_text_buffer_delete_interactive (document, &start, &end, TRUE);
if (gtk_text_iter_editable (&start, TRUE))
gtk_text_buffer_insert (document, &start, buffer, length);
-
+
gtk_text_buffer_end_user_action (document);
}
@@ -217,7 +217,7 @@ create_charmap_panel (GeditWindow *window)
G_CALLBACK (on_table_status_message),
window);
g_signal_connect (chartable,
- "activate",
+ "activate",
G_CALLBACK (on_table_activate),
window);
@@ -243,7 +243,7 @@ impl_activate (GeditPlugin *plugin,
data = g_slice_new (WindowData);
theme = gtk_icon_theme_get_default ();
-
+
if (gtk_icon_theme_has_icon (theme, "accessories-character-map"))
image = gtk_image_new_from_icon_name ("accessories-character-map",
GTK_ICON_SIZE_MENU);
@@ -252,7 +252,7 @@ impl_activate (GeditPlugin *plugin,
GTK_ICON_SIZE_MENU);
data->panel = create_charmap_panel (window);
-
+
gedit_panel_add_item (panel,
data->panel,
_("Character Map"),
diff --git a/plugins/charmap/gedit-charmap-plugin.h b/plugins/charmap/gedit-charmap-plugin.h
index e5f5ef4..7313ef1 100644
--- a/plugins/charmap/gedit-charmap-plugin.h
+++ b/plugins/charmap/gedit-charmap-plugin.h
@@ -1,6 +1,6 @@
/*
* gedit-charmap-plugin.h - Character map side-pane for gedit
- *
+ *
* Copyright (C) 2006 Steve Frécinaux
*
* This program is free software; you can redistribute it and/or modify
diff --git a/plugins/colorpicker/colorpicker.py b/plugins/colorpicker/colorpicker.py
index a45d891..68075b3 100644
--- a/plugins/colorpicker/colorpicker.py
+++ b/plugins/colorpicker/colorpicker.py
@@ -1,19 +1,19 @@
# -*- coding: utf-8 -*-
# Color picker plugin
# This file is part of gedit-plugins
-#
+#
# Copyright (C) 2006 Jesse van den Kieboom
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330,
@@ -121,12 +121,12 @@ class ColorPickerPlugin(gedit.Plugin):
def skip_hex(self, buf, iter, next_char):
while True:
char = iter.get_char()
-
+
if not char:
return
if char.lower() not in \
- ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f'):
return
@@ -248,9 +248,9 @@ class ColorPickerPlugin(gedit.Plugin):
def on_dialog_response(self, dialog, response):
if response == gtk.RESPONSE_OK:
color = dialog.colorsel.get_current_color()
-
+
self.scale_color(color)
-
+
self.insert_color("%02x%02x%02x" % (color.red, \
color.green, color.blue))
else:
diff --git a/plugins/commander/commander/__init__.py b/plugins/commander/commander/__init__.py
index f02693b..2d00d27 100644
--- a/plugins/commander/commander/__init__.py
+++ b/plugins/commander/commander/__init__.py
@@ -13,10 +13,10 @@ import commands
class Commander(gedit.Plugin):
def __init__(self):
gedit.Plugin.__init__(self)
-
+
self._instances = {}
self._path = os.path.dirname(__file__)
-
+
if not self._path in sys.path:
sys.path.insert(0, self._path)
@@ -24,17 +24,17 @@ class Commander(gedit.Plugin):
os.path.expanduser('~/.gnome2/gedit/commander/modules'),
os.path.join(self.get_data_dir(), 'modules')
])
-
+
def activate(self, window):
self._instances[window] = WindowHelper(self, window)
def deactivate(self, window):
self._instances[window].deactivate()
del self._instances[window]
-
+
if len(self._instances) == 0:
commands.Commands().stop()
-
+
if self._path in sys.path:
sys.path.remove(self._path)
diff --git a/plugins/commander/commander/commands/__init__.py b/plugins/commander/commander/commands/__init__.py
index b3abc64..16cae9e 100644
--- a/plugins/commander/commander/commands/__init__.py
+++ b/plugins/commander/commander/commands/__init__.py
@@ -22,14 +22,14 @@ def attrs(**kwargs):
def generator(f):
for k in kwargs:
setattr(f, k, kwargs[k])
-
+
return f
-
+
return generator
def autocomplete(d={}, **kwargs):
ret = {}
-
+
for dic in (d, kwargs):
for k in dic:
if type(dic[k]) == types.FunctionType:
@@ -62,7 +62,7 @@ class Commands(Singleton):
def __init__(self, generator):
self.generator = generator
self.retval = None
-
+
def autocomplete_func(self):
if retval == result.Result.PROMPT:
return retval.autocomplete
@@ -72,16 +72,16 @@ class Commands(Singleton):
class State:
def __init__(self):
self.clear()
-
+
def clear(self):
self.stack = []
def top(self):
return self.stack[0]
-
+
def run(self, ret):
ct = self.top()
-
+
if ret:
ct.retval = ct.generator.send(ret)
else:
@@ -100,7 +100,7 @@ class Commands(Singleton):
self.stack[0].generator.close()
except GeneratorExit:
pass
-
+
del self.stack[0]
def __len__(self):
@@ -114,24 +114,24 @@ class Commands(Singleton):
self._dirs = []
self._monitors = []
self._accel_group = None
-
+
self._timeouts = {}
-
+
self._stack = []
-
+
def set_dirs(self, dirs):
self._dirs = dirs
-
+
def stop(self):
for mon in self._monitors:
mon.cancel()
-
+
self._monitors = []
self._modules = None
-
+
for k in self._timeouts:
glib.source_remove(self._timeouts[k])
-
+
self._timeouts = {}
def accelerator_activated(self, accel, mod, state, entry):
@@ -165,11 +165,11 @@ class Commands(Singleton):
def modules(self):
self.ensure()
return list(self._modules)
-
+
def add_monitor(self, d):
gfile = gio.File(d)
monitor = None
-
+
try:
monitor = gfile.monitor_directory(gio.FILE_MONITOR_NONE, None)
except gio.Error, e:
@@ -180,54 +180,54 @@ class Commands(Singleton):
if monitor:
monitor.connect('changed', self.on_monitor_changed)
self._monitors.append(monitor)
-
+
def scan(self, d):
files = []
-
+
try:
files = os.listdir(d)
except OSError:
pass
-
+
for f in files:
full = os.path.join(d, f)
# Test for python files or modules
if is_commander_module(full):
if self.add_module(full) and os.path.isdir(full):
- # Add monitor on the module directory if module was
+ # Add monitor on the module directory if module was
# successfully added. TODO: recursively add monitors
self.add_monitor(full)
-
+
# Add a monitor on the scanned directory itself
self.add_monitor(d)
-
+
def module_name(self, filename):
# Module name is the basename without the .py
return os.path.basename(os.path.splitext(filename)[0])
-
+
def add_module(self, filename):
base = self.module_name(filename)
-
+
# Check if module already exists
if base in self._modules:
return
-
+
# Create new 'empty' module
mod = module.Module(base, os.path.dirname(filename))
bisect.insort_right(self._modules, mod)
-
+
# Reload the module
self.reload_module(mod)
return True
-
+
def ensure(self):
# Ensure that modules have been scanned
if self._modules != None:
return
self._modules = []
-
+
for d in self._dirs:
self.scan(d)
@@ -243,7 +243,7 @@ class Commands(Singleton):
return self._run_generator(state)
return self.run(state, retval)
-
+
except StopIteration:
state.pop()
@@ -252,7 +252,7 @@ class Commands(Singleton):
except Exception, e:
# Something error like, we throw on the parent generator
state.pop()
-
+
if state:
state.top().generator.throw(type(e), e)
else:
@@ -260,13 +260,13 @@ class Commands(Singleton):
raise
return None
-
+
def run(self, state, ret=None):
if type(ret) == types.GeneratorType:
# Ok, this is cool stuff, generators can ask and susped execution
# of commands, for instance to prompt for some more information
state.push(ret)
-
+
return self._run_generator(state)
elif not isinstance(ret, result.Result) and len(state) > 1:
# Basicly, send it to the previous?
@@ -275,15 +275,15 @@ class Commands(Singleton):
return self._run_generator(state, ret)
else:
return ret
-
+
def execute(self, state, argstr, words, wordsstr, entry, modifier):
self.ensure()
-
- if state:
+
+ if state:
return self._run_generator(state, [argstr, words, modifier])
cmd = completion.single_command(wordsstr, 0)
-
+
if not cmd:
raise exceptions.Execute('Could not find command: ' + wordsstr[0])
@@ -291,28 +291,28 @@ class Commands(Singleton):
argstr = argstr[words[1].start(0):]
else:
argstr = ''
-
+
# Execute command
return self.run(state, cmd.execute(argstr, wordsstr[1:], entry, modifier))
-
+
def invoke(self, entry, modifier, command, args, argstr=None):
self.ensure()
-
+
cmd = completion.single_command([command], 0)
-
+
if not cmd:
raise exceptions.Execute('Could not find command: ' + command)
-
+
if argstr == None:
argstr = ' '.join(args)
ret = cmd.execute(argstr, args, entry, modifier)
-
+
if type(ret) == types.GeneratorType:
raise exceptions.Execute('Cannot invoke commands that yield (yet)')
else:
return ret
-
+
def resolve_module(self, path, load=True):
if not self._modules or not is_commander_module(path):
return None
@@ -326,7 +326,7 @@ class Commands(Singleton):
# Find module
idx = bisect.bisect_left(self._modules, base)
mod = None
-
+
if idx < len(self._modules):
mod = self._modules[idx]
@@ -335,7 +335,7 @@ class Commands(Singleton):
self.add_module(path)
return None
-
+
return mod
def remove_module_accelerators(self, modules):
@@ -366,7 +366,7 @@ class Commands(Singleton):
def reload_module(self, mod):
if isinstance(mod, basestring):
mod = self.resolve_module(mod)
-
+
if not mod or not self._modules:
return
@@ -393,7 +393,7 @@ class Commands(Singleton):
def on_timeout_delete(self, path, mod):
if not path in self._timeouts:
return False
-
+
# Remove the module
mod.unload()
self.remove_module(mod)
@@ -408,23 +408,23 @@ class Commands(Singleton):
elif evnt == gio.FILE_MONITOR_EVENT_DELETED:
path = gfile1.get_path()
mod = self.resolve_module(path, False)
-
+
if not mod:
return
if path in self._timeouts:
glib.source_remove(self._timeouts[path])
-
+
# We add a timeout because a common save strategy causes a
# DELETE/CREATE event chain
self._timeouts[path] = glib.timeout_add(500, self.on_timeout_delete, path, mod)
elif evnt == gio.FILE_MONITOR_EVENT_CREATED:
path = gfile1.get_path()
-
+
# Check if this CREATE followed a previous DELETE
if path in self._timeouts:
glib.source_remove(self._timeouts[path])
del self._timeouts[path]
-
+
# Reload the module
self.reload_module(path)
diff --git a/plugins/commander/commander/commands/completion.py b/plugins/commander/commander/commands/completion.py
index 1ec9244..892650c 100644
--- a/plugins/commander/commander/commands/completion.py
+++ b/plugins/commander/commander/commands/completion.py
@@ -11,13 +11,13 @@ __all__ = ['command', 'filename']
def _common_prefix_part(first, second):
length = min(len(first), len(second))
-
+
for i in range(0, length):
if first[i] != second[i]:
return first[:i]
return first[:length]
-
+
def common_prefix(args, sep=None):
# A common prefix can be something like
# first: some-thing
@@ -30,7 +30,7 @@ def common_prefix(args, sep=None):
if len(args) == 1:
return str(args[0])
-
+
first = str(args[0])
second = str(args[1])
@@ -43,9 +43,9 @@ def common_prefix(args, sep=None):
for i in range(0, min(len(first), len(second))):
ret.append(_common_prefix_part(first[i], second[i]))
-
+
ret = sep.join(ret)
-
+
del args[0]
args[0] = ret
@@ -60,37 +60,37 @@ def _expand_commands(cmds):
del cmds[:]
# Expand 'commands' to all the respective subcommands
-
+
for cmd in old:
for c in cmd.commands():
bisect.insort(cmds, c)
def _filter_command(cmd, subs):
parts = cmd.name.split('-')
-
+
if len(subs) > len(parts):
return False
-
+
for i in xrange(0, len(subs)):
if not parts[i].startswith(subs[i]):
return False
-
+
return True
def _filter_commands(cmds, subs):
# See what parts of cmds still match the parts in subs
idx = bisect.bisect_left(cmds, subs[0])
ret = []
-
+
while idx < len(cmds):
if not cmds[idx].name.startswith(subs[0]):
break
-
+
if _filter_command(cmds[idx], subs):
ret.append(cmds[idx])
-
+
idx += 1
-
+
return ret
def single_command(words, idx):
@@ -100,10 +100,10 @@ def single_command(words, idx):
return None
ret[0] = filter(lambda x: x.method, ret[0])
-
+
if not ret[0]:
return None
-
+
return ret[0][0]
def command(words, idx):
@@ -118,16 +118,16 @@ def command(words, idx):
if not cmds:
return None
-
- subs = i.split('-')
+
+ subs = i.split('-')
cmds = _filter_commands(cmds, subs)
if not cmds:
return None
-
+
if not cmds:
return None
-
+
if len(parts) == 1:
completed = common_prefix(cmds)
else:
@@ -140,10 +140,10 @@ def _file_color(path):
format = '<span color="#799ec6">%s</span>'
else:
format = '%s'
-
+
return format % (saxutils.escape(os.path.basename(path)),)
-def _sort_nicely(l):
+def _sort_nicely(l):
convert = lambda text: int(text) if text.isdigit() else text
alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)]
@@ -152,24 +152,24 @@ def _sort_nicely(l):
def filename(words, idx, view):
prefix = os.path.dirname(words[idx])
partial = os.path.expanduser(words[idx])
-
+
doc = view.get_buffer()
-
+
if not doc.is_untitled():
root = os.path.dirname(doc.get_location().get_path())
else:
root = os.path.expanduser('~/')
-
+
if not os.path.isabs(partial):
partial = os.path.join(root, partial)
-
+
dirname = os.path.dirname(partial)
-
+
try:
files = os.listdir(dirname)
except OSError:
return None
-
+
base = os.path.basename(partial)
ret = []
real = []
@@ -178,9 +178,9 @@ def filename(words, idx, view):
if f.startswith(base) and (base or not f.startswith('.')):
real.append(os.path.join(dirname, f))
ret.append(os.path.join(prefix, f))
-
+
_sort_nicely(real)
-
+
if len(ret) == 1:
if os.path.isdir(real[0]):
after = '/'
@@ -195,5 +195,5 @@ def words(ret):
def decorator(words, idx):
rr = filter(lambda x: x.startswith(words[idx]), ret)
return rr, common_prefix(rr)
-
+
return decorator
diff --git a/plugins/commander/commander/commands/exceptions.py b/plugins/commander/commander/commands/exceptions.py
index a1f2ea2..b0f0a01 100644
--- a/plugins/commander/commander/commands/exceptions.py
+++ b/plugins/commander/commander/commands/exceptions.py
@@ -1,6 +1,6 @@
class Execute(Exception):
def __init__(self, msg):
self.msg = msg
-
+
def __str__(self):
return self.msg
diff --git a/plugins/commander/commander/commands/method.py b/plugins/commander/commander/commands/method.py
index dffab2e..ff1f157 100644
--- a/plugins/commander/commander/commands/method.py
+++ b/plugins/commander/commander/commands/method.py
@@ -10,7 +10,7 @@ class Method:
self.name = name.replace('_', '-')
self.parent = parent
self._func_props = None
-
+
def __str__(self):
return self.name
@@ -28,23 +28,23 @@ class Method:
def args(self):
fp = self.func_props()
-
+
return fp.args, fp.varargs
-
+
def func_props(self):
if not self._func_props:
# Introspect the function arguments
self._func_props = utils.getargspec(self.method)
-
+
return self._func_props
-
+
def commands(self):
return []
-
+
def cancel(self, view):
if self.parent:
self.parent.cancel(view, self)
-
+
def cancel_continuation(self, view):
if self.parent:
self.parent.continuation(view, self)
@@ -57,20 +57,20 @@ class Method:
def oneline_doc(self):
return self.doc().split("\n")[0]
-
+
def execute(self, argstr, words, entry, modifier, kk = {}):
fp = self.func_props()
-
+
kwargs = {'argstr': argstr, 'args': words, 'entry': entry, 'view': entry.view(), 'modifier': modifier, 'window': entry.view().get_toplevel()}
oargs = list(fp.args)
args = []
idx = 0
-
+
if fp.defaults:
numdef = len(fp.defaults)
else:
numdef = 0
-
+
for k in fp.args:
if k in kwargs:
args.append(kwargs[k])
diff --git a/plugins/commander/commander/commands/module.py b/plugins/commander/commander/commands/module.py
index 481fa0b..5254e9c 100644
--- a/plugins/commander/commander/commands/module.py
+++ b/plugins/commander/commander/commands/module.py
@@ -18,7 +18,7 @@ class Module(method.Method):
if type(mod) == types.ModuleType:
self.mod = mod
-
+
if '__default__' in mod.__dict__:
self.method = mod.__dict__['__default__']
else:
@@ -27,7 +27,7 @@ class Module(method.Method):
self.mod = None
self._dirname = mod
self._rollback = rollbackimporter.RollbackImporter()
-
+
def commands(self):
if self._commands == None:
self.scan_commands()
@@ -36,27 +36,27 @@ class Module(method.Method):
def clear(self):
self._commands = None
-
+
def roots(self):
if self._roots == None:
if not self.mod:
return []
-
+
dic = self.mod.__dict__
-
+
if '__root__' in dic:
root = dic['__root__']
else:
root = []
-
+
root = filter(lambda x: x in dic and type(dic[x]) == types.FunctionType, root)
self._roots = map(lambda x: method.Method(dic[x], x, self.mod), root)
-
+
return self._roots
-
+
def scan_commands(self):
self._commands = []
-
+
if self.mod == None:
return
@@ -70,30 +70,30 @@ class Module(method.Method):
for k in dic:
if k.startswith('_') or k in root:
continue
-
+
item = dic[k]
-
+
if type(item) == types.FunctionType:
bisect.insort(self._commands, method.Method(item, k, self))
elif type(item) == types.ModuleType and utils.is_commander_module(item):
mod = Module(k, item, self)
bisect.insort(self._commands, mod)
-
+
# Insert root functions into this module
for r in mod.roots():
bisect.insert(self._commands, r)
-
+
def unload(self):
self._commands = None
if not self._dirname:
return False
-
+
self._rollback.uninstall()
self.mod = None
return True
-
+
def reload(self):
if not self.unload():
return
@@ -105,14 +105,14 @@ class Module(method.Method):
try:
sys.path.insert(0, self._dirname)
-
+
self._rollback.monitor()
self.mod = __import__(self.name, globals(), locals(), [], 0)
self._rollback.cancel()
-
+
if not utils.is_commander_module(self.mod):
raise Exception('Module is not a commander module...')
-
+
if '__default__' in self.mod.__dict__:
self.method = self.mod.__dict__['__default__']
else:
@@ -122,10 +122,10 @@ class Module(method.Method):
except:
sys.path = oldpath
self._rollback.uninstall()
-
+
if self.name in sys.modules:
del sys.modules[self.name]
raise
-
+
sys.path = oldpath
diff --git a/plugins/commander/commander/commands/result.py b/plugins/commander/commander/commands/result.py
index b4e4b77..90e6dea 100644
--- a/plugins/commander/commander/commands/result.py
+++ b/plugins/commander/commander/commands/result.py
@@ -6,10 +6,10 @@ class Result(object):
def __init__(self, value):
self._value = value
-
+
def __int__(self):
return self._value
-
+
def __cmp__(self, other):
if isinstance(other, int) or isinstance(other, Result):
return cmp(int(self), int(other))
@@ -31,10 +31,10 @@ class Suspend(Result):
def __init__(self):
Result.__init__(self, Result.SUSPEND)
self._callbacks = []
-
+
def register(self, cb, *args):
self._callbacks.append([cb, args])
-
+
def resume(self):
for cb in self._callbacks:
args = cb[1]
diff --git a/plugins/commander/commander/commands/rollbackimporter.py b/plugins/commander/commander/commands/rollbackimporter.py
index e1e4e2c..21cca05 100644
--- a/plugins/commander/commander/commands/rollbackimporter.py
+++ b/plugins/commander/commander/commands/rollbackimporter.py
@@ -6,7 +6,7 @@ class RollbackImporter:
"Creates an instance and installs as the global importer"
self._new_modules = []
self._original_import = __builtins__['__import__']
-
+
def monitor(self):
__builtins__['__import__'] = self._import
@@ -17,20 +17,20 @@ class RollbackImporter:
maybe = not name in sys.modules
mod = apply(self._original_import, (name, globals, locals, fromlist, level))
-
+
if maybe and utils.is_commander_module(mod):
self._new_modules.append(name)
-
+
return mod
def uninstall(self):
self.cancel()
-
+
for modname in self._new_modules:
if modname in sys.modules:
del sys.modules[modname]
-
+
self._new_modules = []
-
-
+
+
diff --git a/plugins/commander/commander/entry.py b/plugins/commander/commander/entry.py
index 36ed4e1..e887ee3 100644
--- a/plugins/commander/commander/entry.py
+++ b/plugins/commander/commander/entry.py
@@ -23,18 +23,18 @@ class Entry(gtk.EventBox):
def __init__(self, view):
gtk.EventBox.__init__(self)
self._view = view
-
+
hbox = gtk.HBox(False, 3)
hbox.show()
hbox.set_border_width(3)
-
+
self._entry = gtk.Entry()
self._entry.modify_font(self._view.style.font_desc)
self._entry.set_has_frame(False)
self._entry.set_name('command-bar')
self._entry.modify_text(gtk.STATE_NORMAL, self._view.style.text[gtk.STATE_NORMAL])
self._entry.set_app_paintable(True)
-
+
self._entry.connect('realize', self.on_realize)
self._entry.connect('expose-event', self.on_entry_expose)
@@ -45,34 +45,34 @@ class Entry(gtk.EventBox):
self._prompt_label.modify_font(self._view.style.font_desc)
self._prompt_label.show()
self._prompt_label.modify_fg(gtk.STATE_NORMAL, self._view.style.text[gtk.STATE_NORMAL])
-
+
self.modify_bg(gtk.STATE_NORMAL, self.background_gdk())
self._entry.modify_base(gtk.STATE_NORMAL, self.background_gdk())
-
+
self._entry.connect('focus-out-event', self.on_entry_focus_out)
self._entry.connect('key-press-event', self.on_entry_key_press)
-
+
self.connect_after('size-allocate', self.on_size_allocate)
self.connect_after('expose-event', self.on_expose)
self.connect_after('realize', self.on_realize)
-
+
self._history = History(os.path.expanduser('~/.gnome2/gedit/commander/history'))
self._prompt = None
self._accel_group = None
-
+
hbox.pack_start(self._prompt_label, False, False, 0)
hbox.pack_start(self._entry, True, True, 0)
-
+
self.add(hbox)
self.attach()
self._entry.grab_focus()
self._wait_timeout = 0
self._info_window = None
-
+
self.connect('destroy', self.on_destroy)
-
+
self._history_prefix = None
self._suspended = None
self._handlers = [
@@ -83,20 +83,20 @@ class Entry(gtk.EventBox):
[0, gtk.keysyms.Tab, self.on_complete, None],
[0, gtk.keysyms.ISO_Left_Tab, self.on_complete, None]
]
-
+
self._re_complete = re.compile('("((?:\\\\"|[^"])*)"?|\'((?:\\\\\'|[^\'])*)\'?|[^\s]+)')
self._command_state = commands.Commands.State()
-
+
def view(self):
return self._view
def on_realize(self, widget):
widget.window.set_back_pixmap(None, False)
-
+
def on_entry_expose(self, widget, evnt):
ct = evnt.window.cairo_create()
ct.rectangle(evnt.area.x, evnt.area.y, evnt.area.width, evnt.area.height)
-
+
bg = self.background_color()
ct.set_source_rgb(bg[0], bg[1], bg[2])
ct.fill()
@@ -106,10 +106,10 @@ class Entry(gtk.EventBox):
def on_expose(self, widget, evnt):
ct = evnt.window.cairo_create()
color = self.background_color()
-
+
ct.rectangle(evnt.area.x, evnt.area.y, evnt.area.width, evnt.area.height)
ct.clip()
-
+
# Draw separator line
ct.move_to(0, 0)
ct.set_line_width(1)
@@ -118,30 +118,30 @@ class Entry(gtk.EventBox):
ct.set_source_rgb(1 - color[0], 1 - color[1], 1 - color[2])
ct.stroke()
return False
-
+
def on_size_allocate(self, widget, alloc):
vwwnd = self._view.get_window(gtk.TEXT_WINDOW_BOTTOM).get_parent()
size = vwwnd.get_size()
position = vwwnd.get_position()
self._view.set_border_window_size(gtk.TEXT_WINDOW_BOTTOM, alloc.height)
-
+
def attach(self):
- # Attach ourselves in the text view, and position just above the
+ # Attach ourselves in the text view, and position just above the
# text window
self._view.set_border_window_size(gtk.TEXT_WINDOW_BOTTOM, 1)
alloc = self._view.allocation
-
+
self.show()
self._view.add_child_in_window(self, gtk.TEXT_WINDOW_BOTTOM, 0, 0)
self.set_size_request(alloc.width, -1)
def background_gdk(self):
bg = self.background_color()
-
+
bg = map(lambda x: int(x * 65535), bg)
return gtk.gdk.Color(bg[0], bg[1], bg[2])
-
+
def background_color(self):
bg = self._view.get_style().base[self._view.state]
@@ -168,7 +168,7 @@ class Entry(gtk.EventBox):
def on_entry_key_press(self, widget, evnt):
state = evnt.state & gtk.accelerator_get_default_mod_mask()
text = self._entry.get_text()
-
+
if evnt.keyval == gtk.keysyms.Escape:
if self._info_window:
if self._suspended:
@@ -227,34 +227,34 @@ class Entry(gtk.EventBox):
if self._info_window and self._info_window.empty():
self._info_window.destroy()
-
+
self._history_prefix = None
return False
-
+
def on_history_move(self, direction, modifier):
pos = self._entry.get_position()
-
+
self._history.update(self._entry.get_text())
-
+
if self._history_prefix == None:
if len(self._entry.get_text()) == pos:
self._history_prefix = self._entry.get_chars(0, pos)
else:
self._history_prefix = ''
-
+
if self._history_prefix == None:
hist = ''
else:
hist = self._history_prefix
-
+
next = self._history.move(direction, hist)
-
+
if next != None:
self._entry.set_text(next)
self._entry.set_position(-1)
-
+
return True
-
+
def prompt(self, pr=''):
self._prompt = pr
@@ -272,20 +272,20 @@ class Entry(gtk.EventBox):
if self._info_window == None:
self._info_window = Info(self)
self._info_window.show()
-
+
self._info_window.connect('destroy', self.on_info_window_destroy)
-
+
def on_info_window_destroy(self, widget):
self._info_window = None
-
+
def info_show(self, text='', use_markup=False):
self.make_info()
self._info_window.add_lines(text, use_markup)
-
+
def info_status(self, text):
self.make_info()
self._info_window.status(text)
-
+
def info_add_action(self, stock, callback, data=None):
self.make_info()
return self._info_window.add_action(stock, callback, data)
@@ -295,11 +295,11 @@ class Entry(gtk.EventBox):
self._history.add()
self._history_prefix = None
self._entry.set_text('')
-
+
def on_wait_cancel(self):
if self._suspended:
self._suspended.resume()
-
+
if self._cancel_button:
self._cancel_button.destroy()
@@ -307,11 +307,11 @@ class Entry(gtk.EventBox):
self._info_window.destroy()
self._entry.grab_focus()
self._entry.set_sensitive(True)
-
+
def _show_wait_cancel(self):
self._cancel_button = self.info_add_action(gtk.STOCK_STOP, self.on_wait_cancel)
self.info_status('<i>Waiting to finish...</i>')
-
+
self._wait_timeout = 0
return False
@@ -328,7 +328,7 @@ class Entry(gtk.EventBox):
self._cancel_button.destroy()
self._cancel_button = None
self.info_status(None)
-
+
self._entry.set_sensitive(True)
self.command_history_done()
@@ -340,7 +340,7 @@ class Entry(gtk.EventBox):
def ellipsize(self, s, size):
if len(s) <= size:
return s
-
+
mid = (size - 4) / 2
return s[:mid] + '...' + s[-mid:]
@@ -396,7 +396,7 @@ class Entry(gtk.EventBox):
text = self._entry.get_text().strip()
words = list(self._re_complete.finditer(text))
wordsstr = []
-
+
for word in words:
spec = self._complete_word_match(word)
wordsstr.append(spec[0])
@@ -408,7 +408,7 @@ class Entry(gtk.EventBox):
self.run_command(lambda: commands.Commands().execute(self._command_state, text, words, wordsstr, self, modifier))
return True
-
+
def on_complete(self, dummy, modifier):
# First split all the text in words
text = self._entry.get_text()
@@ -416,11 +416,11 @@ class Entry(gtk.EventBox):
words = list(self._re_complete.finditer(text))
wordsstr = []
-
+
for word in words:
spec = self._complete_word_match(word)
wordsstr.append(spec[0])
-
+
# Find out at which word the cursor actually is
# Examples:
# * hello world|
@@ -430,7 +430,7 @@ class Entry(gtk.EventBox):
# * hello | world
# * "hello world|"
posidx = None
-
+
for idx in xrange(0, len(words)):
spec = self._complete_word_match(words[idx])
@@ -452,12 +452,12 @@ class Entry(gtk.EventBox):
wordsstr.append('')
words.append(None)
posidx = len(wordsstr) - 1
-
+
# First word completes a command, if not in any special 'mode'
# otherwise, relay completion to the command, or complete by advice
# from the 'mode' (prompt)
cmds = commands.Commands()
-
+
if not self._command_state and posidx == 0:
# Complete the first command
ret = commands.completion.command(words=wordsstr, idx=posidx)
@@ -472,18 +472,18 @@ class Entry(gtk.EventBox):
if cmd:
complete = cmd.autocomplete_func()
-
+
if not complete:
return True
-
+
# 'complete' contains a dict with arg -> func to do the completion
# of the named argument the command (or stack item) expects
args, varargs = cmd.args()
-
+
# Remove system arguments
s = ['argstr', 'args', 'entry', 'view']
args = filter(lambda x: not x in s, args)
-
+
if posidx - 1 < len(args):
arg = args[posidx - 1]
elif varargs:
@@ -493,23 +493,23 @@ class Entry(gtk.EventBox):
if not arg in complete:
return True
-
+
func = complete[arg]
try:
spec = utils.getargspec(func)
-
+
kwargs = {
'words': wordsstr[1:],
'idx': posidx - 1,
'view': self._view
}
-
+
if not spec.keywords:
for k in kwargs.keys():
if not k in spec.args:
del kwargs[k]
-
+
ret = func(**kwargs)
except Exception, e:
# Can be number of arguments, or return values or simply buggy
@@ -517,18 +517,18 @@ class Entry(gtk.EventBox):
print e
traceback.print_exc()
return True
-
+
if not ret or not ret[0]:
return True
-
+
res = ret[0]
completed = ret[1]
-
+
if len(ret) > 2:
after = ret[2]
else:
after = ' '
-
+
# Replace the word
if words[posidx] == None:
# At end of everything, just append
@@ -546,11 +546,11 @@ class Entry(gtk.EventBox):
if len(res) == 1:
# Full completion
lastpos = self._entry.get_position()
-
+
if not isinstance(res[0], commands.module.Module) or not res[0].commands():
if words[posidx] and after == ' ' and (words[posidx].group(2) != None or words[posidx].group(3) != None):
lastpos = lastpos + 1
-
+
self._entry.insert_text(after, lastpos)
self._entry.set_position(lastpos + 1)
elif completed == wordsstr[posidx] or not res[0].method:
@@ -563,7 +563,7 @@ class Entry(gtk.EventBox):
# Show popup with completed items
if self._info_window:
self._info_window.clear()
-
+
ret = []
for x in res:
@@ -575,7 +575,7 @@ class Entry(gtk.EventBox):
self.info_show("\n".join(ret), True)
return True
-
+
def on_destroy(self, widget):
self._view.set_border_window_size(gtk.TEXT_WINDOW_BOTTOM, 0)
diff --git a/plugins/commander/commander/history.py b/plugins/commander/commander/history.py
index 5196686..743e7be 100644
--- a/plugins/commander/commander/history.py
+++ b/plugins/commander/commander/history.py
@@ -7,27 +7,27 @@ class History:
self._ptr = 0
self.load()
-
+
def find(self, direction, prefix):
ptr = self._ptr + direction
-
+
while ptr >= 0 and ptr < len(self._history):
if self._history[ptr].startswith(prefix):
return ptr
ptr += direction
-
+
return -1
-
+
def move(self, direction, prefix):
next = self.find(direction, prefix)
-
+
if next != -1:
self._ptr = next
return self._history[self._ptr]
else:
return None
-
+
def up(self, prefix=''):
return self.move(-1, prefix)
@@ -39,10 +39,10 @@ class History:
self._history.append('')
self._ptr = len(self._history) - 1
-
+
def update(self, line):
self._history[self._ptr] = line
-
+
def load(self):
try:
self._history = map(lambda x: x.strip("\n"), file(self._filename, 'r').readlines())
@@ -50,16 +50,16 @@ class History:
self._ptr = len(self._history) - 1
except IOError:
pass
-
+
def save(self):
try:
os.makedirs(os.path.dirname(self._filename))
except OSError:
pass
-
+
try:
f = file(self._filename, 'w')
-
+
if self._history[-1] == '':
hist = self._history[:-1]
else:
diff --git a/plugins/commander/commander/info.py b/plugins/commander/commander/info.py
index 1caa491..88f6444 100644
--- a/plugins/commander/commander/info.py
+++ b/plugins/commander/commander/info.py
@@ -6,12 +6,12 @@ import pango
class Info(TransparentWindow):
def __init__(self, entry):
TransparentWindow.__init__(self, gtk.WINDOW_POPUP)
-
+
self._entry = entry
self._vbox = gtk.VBox(False, 3)
-
+
self.set_transient_for(entry.get_toplevel())
-
+
self._vw = gtk.ScrolledWindow()
self._vw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER)
self._vw.show()
@@ -21,14 +21,14 @@ class Info(TransparentWindow):
self._text.modify_text(gtk.STATE_NORMAL, entry._entry.style.text[gtk.STATE_NORMAL])
self._text.connect('expose-event', self.on_text_expose)
self._text.set_wrap_mode(gtk.WRAP_WORD_CHAR)
-
+
buf = self._text.get_buffer()
-
+
buf.connect_after('insert-text', self.on_text_insert_text)
buf.connect_after('delete-range', self.on_text_delete_range)
-
+
self._text.set_editable(False)
-
+
self._vw.add(self._text)
self._vbox.pack_end(self._vw, expand=False, fill=False)
self._vbox.show()
@@ -37,20 +37,20 @@ class Info(TransparentWindow):
self.add(self._vbox)
self._text.show()
self._status_label = None
-
+
self.props.can_focus = False
self.set_border_width(8)
-
+
self._text.connect('realize', self.on_text_realize)
-
+
self.attach()
self.show()
-
+
self.connect_after('size-allocate', self.on_size_allocate)
self._vw.connect_after('size-allocate', self.on_text_size_allocate)
self.max_lines = 10
-
+
self._attr_map = {
pango.ATTR_STYLE: 'style',
pango.ATTR_WEIGHT: 'weight',
@@ -78,101 +78,101 @@ class Info(TransparentWindow):
self._status_label.set_alignment(0, 0.5)
self._status_label.set_padding(10, 0)
self._status_label.set_use_markup(True)
-
+
self.ensure_button_bar()
self._button_bar.pack_start(self._status_label, True, True, 0)
-
+
if text != None:
self._status_label.set_markup(text)
elif self._status_label:
self._status_label.destroy()
-
+
if not self._button_bar and self.empty():
self.destroy()
-
+
def attrs_to_tags(self, attrs):
buf = self._text.get_buffer()
table = buf.get_tag_table()
ret = []
-
+
for attr in attrs:
if not attr.type in self._attr_map:
continue
-
+
if attr.type == pango.ATTR_FOREGROUND or attr.type == pango.ATTR_BACKGROUND:
value = attr.color
else:
value = attr.value
-
+
tagname = str(attr.type) + ':' + str(value)
tag = table.lookup(tagname)
-
+
if not tag:
tag = buf.create_tag(tagname)
tag.set_property(self._attr_map[attr.type], value)
-
+
ret.append(tag)
-
+
return ret
-
+
def add_lines(self, line, use_markup=False):
buf = self._text.get_buffer()
-
+
if not buf.get_start_iter().equal(buf.get_end_iter()):
line = "\n" + line
-
+
if not use_markup:
buf.insert(buf.get_end_iter(), line)
return
-
+
try:
ret = pango.parse_markup(line)
except Exception, e:
print 'Could not parse markup:', e
buf.insert(buf.get_end_iter(), line)
return
-
+
piter = ret[0].get_iterator()
text = ret[1]
-
+
while piter:
attrs = piter.get_attrs()
begin, end = piter.range()
-
+
tags = self.attrs_to_tags(attrs)
buf.insert_with_tags(buf.get_end_iter(), text[begin:end], *tags)
-
+
if not piter.next():
break
-
+
def toomany_lines(self):
buf = self._text.get_buffer()
piter = buf.get_start_iter()
num = 0
-
+
while self._text.forward_display_line(piter):
num += 1
-
+
if num > self.max_lines:
return True
-
- return False
-
+
+ return False
+
def contents_changed(self):
buf = self._text.get_buffer()
-
+
if self.toomany_lines() and (self._vw.get_policy()[1] != gtk.POLICY_ALWAYS):
self._vw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
-
+
layout = self._text.create_pango_layout('Some text to measure')
extents = layout.get_pixel_extents()
-
+
self._text.set_size_request(-1, extents[1][3] * self.max_lines)
elif not self.toomany_lines() and (self._vw.get_policy()[1] == gtk.POLICY_ALWAYS):
self._vw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER)
self._text.set_size_request(-1, -1)
-
+
if not self.toomany_lines():
size = self.get_size()
self.resize(size[0], 1)
@@ -182,48 +182,48 @@ class Info(TransparentWindow):
self._button_bar = gtk.HBox(False, 3)
self._button_bar.show()
self._vbox.pack_start(self._button_bar, False, False, 0)
-
+
def add_action(self, stock, callback, data=None):
image = gtk.image_new_from_stock(stock, gtk.ICON_SIZE_MENU)
image.show()
-
+
image.set_data('COMMANDER_ACTION_STOCK_ITEM', [stock, gtk.ICON_SIZE_MENU])
-
+
self.ensure_button_bar()
ev = gtk.EventBox()
ev.set_visible_window(False)
ev.add(image)
ev.show()
-
+
self._button_bar.pack_end(ev, False, False, 0)
-
+
ev.connect('button-press-event', self.on_action_activate, callback, data)
ev.connect('enter-notify-event', self.on_action_enter_notify)
ev.connect('leave-notify-event', self.on_action_leave_notify)
-
+
ev.connect_after('destroy', self.on_action_destroy)
return ev
-
+
def on_action_destroy(self, widget):
if self._button_bar and len(self._button_bar.get_children()) == 0:
self._button_bar.destroy()
self._button_bar = None
-
+
def on_action_enter_notify(self, widget, evnt):
img = widget.get_child()
img.set_state(gtk.STATE_PRELIGHT)
widget.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.HAND2))
-
+
stock = img.get_data('COMMANDER_ACTION_STOCK_ITEM')
pix = img.render_icon(stock[0], stock[1])
- img.set_from_pixbuf(pix)
-
+ img.set_from_pixbuf(pix)
+
def on_action_leave_notify(self, widget, evnt):
img = widget.get_child()
img.set_state(gtk.STATE_NORMAL)
widget.window.set_cursor(None)
-
+
stock = img.get_data('COMMANDER_ACTION_STOCK_ITEM')
pix = img.render_icon(stock[0], stock[1])
img.set_from_pixbuf(pix)
@@ -240,77 +240,77 @@ class Info(TransparentWindow):
def on_text_expose(self, widget, evnt):
if evnt.window != widget.get_window(gtk.TEXT_WINDOW_TEXT):
return False
-
+
ct = evnt.window.cairo_create()
ct.save()
-
+
area = evnt.area
ct.rectangle(area.x, area.y, area.width, area.height)
ct.clip()
-
+
self.draw_background(ct, self._text, False)
-
+
ct.restore()
return False
-
+
def on_text_realize(self, widget):
self._text.get_window(gtk.TEXT_WINDOW_TEXT).set_back_pixmap(None, False)
-
+
def attach(self):
vwwnd = self._entry._view.get_window(gtk.TEXT_WINDOW_TEXT)
origin = vwwnd.get_origin()
geom = vwwnd.get_geometry()
margin = 5
-
+
self.realize()
-
+
self.move(origin[0], origin[1] + geom[3] - self.allocation.height)
self.resize(geom[2] - margin * 2, self.allocation.height)
-
+
def on_text_insert_text(self, buf, piter, text, length):
self.contents_changed()
-
+
def on_text_delete_range(self, buf, start, end):
self.contents_changed()
-
+
def on_size_allocate(self, widget, allocation):
vwwnd = self._entry._view.get_window(gtk.TEXT_WINDOW_TEXT)
origin = vwwnd.get_origin()
geom = vwwnd.get_geometry()
self.move(origin[0] + (geom[2] - self.allocation.width) / 2, origin[1] + geom[3] - self.allocation.height)
-
+
def on_expose(self, widget, evnt):
ret = TransparentWindow.on_expose(self, widget, evnt)
-
+
if ret:
return True
-
+
ct = evnt.window.cairo_create()
ct.save()
-
+
area = evnt.area
ct.rectangle(area.x, area.y, area.width, area.height)
- ct.clip()
-
+ ct.clip()
+
color = self.background_color()
-
+
self.background_shape(ct)
ct.set_source_rgba(1 - color[0], 1 - color[1], 1 - color[2], 0.3)
ct.stroke()
-
+
ct.restore()
return False
-
+
def background_shape(self, ct):
w = self.allocation.width
h = self.allocation.height
-
+
ct.set_line_width(1)
radius = 10
-
+
ct.move_to(0.5, h)
if self.is_composited():
@@ -321,10 +321,10 @@ class Info(TransparentWindow):
ct.line_to(w - 0.5, 0)
ct.line_to(w - 0.5, h)
-
+
def background_color(self):
return self._entry.background_color()
-
+
def on_text_size_allocate(self, widget, alloc):
pass
diff --git a/plugins/commander/commander/transparentwindow.py b/plugins/commander/commander/transparentwindow.py
index eb3146e..599035f 100644
--- a/plugins/commander/commander/transparentwindow.py
+++ b/plugins/commander/commander/transparentwindow.py
@@ -12,13 +12,13 @@ class TransparentWindow(gtk.Window):
self.set_events(gtk.gdk.ALL_EVENTS_MASK)
self.set_rgba()
-
+
def set_rgba(self):
cmap = self.get_screen().get_rgba_colormap()
-
+
if not cmap:
return
-
+
self.set_colormap(cmap)
self.connect('realize', self.on_realize)
self.connect('expose-event', self.on_expose)
@@ -39,12 +39,12 @@ class TransparentWindow(gtk.Window):
ct.set_operator(cairo.OPERATOR_SOURCE)
ct.rectangle(0, 0, widget.allocation.width, widget.allocation.height)
ct.set_source_rgba(0, 0, 0, 0)
-
+
if not shape:
ct.fill_preserve()
else:
ct.fill()
-
+
color = self.background_color()
if shape:
@@ -56,15 +56,15 @@ class TransparentWindow(gtk.Window):
def on_expose(self, widget, evnt):
if not self.window:
return
-
+
ct = evnt.window.cairo_create()
ct.save()
-
+
area = evnt.area
ct.rectangle(area.x, area.y, area.width, area.height)
ct.clip()
-
+
self.draw_background(ct)
-
+
ct.restore()
return False
diff --git a/plugins/commander/commander/utils.py b/plugins/commander/commander/utils.py
index a41a24e..3d933bd 100644
--- a/plugins/commander/commander/utils.py
+++ b/plugins/commander/commander/utils.py
@@ -9,15 +9,15 @@ class Struct(dict):
val = super(Struct, self).__getattr__(self, name)
else:
val = self[name]
-
+
return val
-
+
def __setattr__(self, name, value):
if not name in self:
super(Struct, self).__setattr__(self, name, value)
else:
self[name] = value
-
+
def __delattr__(self, name):
del self[name]
@@ -39,5 +39,5 @@ def getargspec(func):
'keywords': ret[2],
'defaults': ret[3]
})
-
+
return ret
\ No newline at end of file
diff --git a/plugins/commander/commander/windowhelper.py b/plugins/commander/commander/windowhelper.py
index 9c71f28..96ff36f 100644
--- a/plugins/commander/commander/windowhelper.py
+++ b/plugins/commander/commander/windowhelper.py
@@ -56,9 +56,9 @@ class WindowHelper:
def update_ui(self):
pass
- def on_commander_mode(self, action):
+ def _do_command(self, group, obj, keyval, mod):
view = self._window.get_active_view()
-
+
if not view:
return False
@@ -74,7 +74,7 @@ class WindowHelper:
self._view = None
return True
-
+
def on_entry_destroy(self, widget):
self._entry = None
self._action_group.get_action('CommanderModeAction').set_active(False)
diff --git a/plugins/commander/modules/doc.py b/plugins/commander/modules/doc.py
index 73ee13a..3bbf307 100644
--- a/plugins/commander/modules/doc.py
+++ b/plugins/commander/modules/doc.py
@@ -11,34 +11,34 @@ class Argument:
self.type = argtype.strip()
self.type_name = typename.strip()
self.name = name.strip()
-
+
class Function:
def __init__(self, text):
self._parse(text)
def _parse(self, text):
self.valid = False
-
+
parser = re.compile('^\\s*(?:(?:\\b(?:static|inline)\\b)\\s+)?(([a-z_:][a-z0-9_:<>]*)(?:\\s*(?:\\b(?:const)\\b)\\s*)?\\s*[*&]*\\s+)?([a-z_][a-z0-9_:~]*)\\s*\\(([^)]*)\\)(\\s*const)?', re.I)
-
+
m = parser.match(text)
-
+
if not m:
return
-
+
self.valid = True
-
+
self.return_type = m.group(1) and m.group(1).strip() != 'void' and m.group(1).strip()
self.return_type_name = self.return_type and m.group(2).strip()
-
+
parts = m.group(3).split('::')
self.name = parts[-1]
-
+
if len(parts) > 1:
self.classname = '::'.join(parts[0:-1])
else:
self.classname = None
-
+
self.constructor = self.name == self.classname
self.destructor = self.name == '~%s' % (self.classname,)
@@ -46,21 +46,21 @@ class Function:
self.args = []
argre = re.compile('(([a-z_:][a-z0-9_:<>]*)(?:\\s*(?:\\s*\\bconst\\b\\s*|[*&])\s*)*)\\s*([a-z_][a-z_0-9]*)$', re.I)
-
+
for arg in m.group(4).split(','):
arg = arg.strip()
-
+
if arg == 'void' or arg == '':
continue
else:
m2 = argre.match(arg.strip())
-
+
if not m2:
self.valid = False
return
-
+
arg = Argument(m2.group(1), m2.group(2), m2.group(3))
-
+
self.args.append(arg)
class Documenter:
@@ -68,29 +68,29 @@ class Documenter:
self.window = window
self.view = view
self.iter = iter
-
+
bus = self.window.get_message_bus()
-
+
self.canplaceholder = bus.lookup('/plugins/snippets', 'parse-and-activate') != None
self.placeholder = 1
self.text = ''
-
+
def append(self, *args):
for text in args:
self.text += str(text)
-
+
return self
-
+
def append_placeholder(self, *args):
if not self.canplaceholder:
return self.append(*args)
-
+
text = " ".join(map(lambda x: str(x), args))
self.text += "${%d:%s}" % (self.placeholder, text)
self.placeholder += 1
-
+
return self
-
+
def insert(self):
if self.canplaceholder:
bus = self.window.get_message_bus()
@@ -98,7 +98,7 @@ class Documenter:
def _make_documenter(window, view):
buf = view.get_buffer()
-
+
bus = window.get_message_bus()
canplaceholder = bus.lookup('/plugins/snippets', 'parse-and-activate') != None
@@ -106,19 +106,19 @@ def _make_documenter(window, view):
insert.set_line_offset(0)
offset = insert.get_offset()
-
+
end = insert.copy()
-
+
# This is just something random
if not end.forward_chars(500):
end = buf.get_end_iter()
- text = insert.get_text(end)
+ text = insert.get_text(end)
func = Function(text)
if not func.valid:
raise commander.commands.exceptions.Execute('Could not find function specification')
-
+
doc = Documenter(window, view, insert)
return doc, func
@@ -128,7 +128,7 @@ def gtk(window, view):
Generate a documentation template for the C or C++ function defined at the
cursor. The cursor needs to be on the first line of the function declaration
for it to work."""
-
+
buf = view.get_buffer()
lang = buf.get_language()
@@ -140,24 +140,24 @@ for it to work."""
# Generate docstring for this function
doc.append("/**\n * ", func.name, ":\n")
structp = re.compile('([A-Z]+[a-zA-Z]*)|struct\s+_([A-Z]+[a-zA-Z]*)')
-
+
for arg in func.args:
sm = structp.match(arg.type_name)
doc.append(" * @", arg.name, ": ")
-
+
if sm:
doc.append_placeholder("A #%s" % (sm.group(1) or sm.group(2),))
else:
doc.append_placeholder("Description")
-
+
doc.append("\n")
-
+
doc.append(" * \n * ").append_placeholder("Description").append(".\n")
-
+
if func.return_type:
sm = structp.match(func.return_type_name)
doc.append(" *\n * Returns: ")
-
+
if sm:
doc.append_placeholder("A #%s" % (sm.group(1) or sm.group(2),))
else:
@@ -176,7 +176,7 @@ cursor. The cursor needs to be on the first line of the function declaration
for it to work."""
buf = view.get_buffer()
-
+
if not buf.get_language().get_id() in ('c', 'chdr', 'cpp'):
raise commander.commands.exceptions.Execute('Don\'t know about this language')
@@ -184,32 +184,32 @@ for it to work."""
# Generate docstring for this function
doc.append("/** \\brief ").append_placeholder("Short description")
-
+
if func.const:
doc.append(" (const)")
-
+
doc.append(".\n")
for arg in func.args:
doc.append(" * @param ", arg.name, " ").append_placeholder("Description").append("\n")
-
+
doc.append(" *\n * ")
-
+
if func.constructor:
doc.append("Constructor.\n *\n * ")
elif func.destructor:
doc.append("Destructor.\n *\n * ")
doc.append_placeholder("Detailed description").append(".\n")
-
+
if func.return_type:
doc.append(" *\n * @return: ")
-
+
if func.return_type == 'bool':
doc.append("true if ").append_placeholder("Description").append(", false otherwise")
else:
doc.append_placeholder("Description")
-
+
doc.append("\n")
doc.append(" *\n */\n")
diff --git a/plugins/commander/modules/edit.py b/plugins/commander/modules/edit.py
index 43ec235..21590a5 100644
--- a/plugins/commander/modules/edit.py
+++ b/plugins/commander/modules/edit.py
@@ -18,31 +18,31 @@ __commander_module__ = True
@commands.autocomplete(filename=commander.commands.completion.filename)
def __default__(filename, view):
"""Edit file: edit <filename>"""
-
+
doc = view.get_buffer()
cwd = os.getcwd()
-
+
if not doc.is_untitled():
cwd = doc.get_location().get_parent().get_path()
else:
cwd = os.path.expanduser('~/')
-
+
if not os.path.isabs(filename):
filename = os.path.join(cwd, filename)
-
+
matches = glob.glob(filename)
files = []
-
+
if matches:
for match in matches:
files.append(gio.File(match))
else:
files.append(gio.File(filename))
-
+
if files:
window = view.get_toplevel()
gedit.commands.load_locations(window, files)
-
+
return commander.commands.result.HIDE
def _dummy_cb(num, total):
@@ -51,38 +51,38 @@ def _dummy_cb(num, total):
@commands.autocomplete(newfile=commander.commands.completion.filename)
def rename(view, newfile):
"""Rename current file: edit.rename <newname>"""
-
+
doc = view.get_buffer()
-
+
if not hasattr(doc, 'set_uri'):
raise commander.commands.exceptions.Execute('Your version of gedit does not support this action')
-
+
if doc.is_untitled():
raise commander.commands.exceptions.Execute('Document is unsaved and thus cannot be renamed')
-
+
if doc.get_modified():
raise commander.commands.exceptions.Execute('You have unsaved changes in your document')
-
+
if not doc.is_local():
raise commander.commands.exceptions.Execute('You can only rename local files')
-
+
f = doc.get_location()
if not f.query_exists():
raise commander.commands.exceptions.Execute('Current document file does not exist')
-
+
if os.path.isabs(newfile):
dest = gio.File(newfile)
else:
dest = f.get_parent().resolve_relative_path(newfile)
-
+
if f.equal(dest):
yield commander.commands.result.HIDE
-
+
if not dest.get_parent().query_exists():
# Check to create parent directory
fstr, words, modifierret = (yield commands.result.Prompt('Directory does not exist, create? [Y/n] '))
-
+
if fstr.strip().lower() in ['y', 'ye', 'yes', '']:
# Create parent directories
try:
@@ -91,16 +91,16 @@ def rename(view, newfile):
raise commander.commands.exceptions.Execute('Could not create directory')
else:
yield commander.commands.result.HIDE
-
+
if dest.query_exists():
fstr, words, modifierret = (yield commands.result.Prompt('Destination already exists, overwrite? [Y/n]'))
-
+
if not fstr.strip().lower() in ['y', 'ye', 'yes', '']:
yield commander.commands.result.HIDE
-
+
try:
f.move(dest, _dummy_cb, flags=gio.FILE_COPY_OVERWRITE)
-
+
doc.set_location(dest)
yield commander.commands.result.HIDE
except Exception, e:
@@ -128,45 +128,45 @@ def _edit_command(view, mod, func=None):
line = 0
gedit.commands.load_location(view.get_toplevel(), location, None, line)
-
+
return True
def _resume_command(view, mod, parts):
if not parts:
return _edit_command(view, mod)
-
+
func = parts[0].replace('-', '_')
if len(parts) == 1 and _mod_has_func(mod, func):
return _edit_command(view, mod, mod.__dict__[func])
elif len(parts) == 1 and _mod_has_alias(mod, parts[0]):
return _edit_command(view, mod)
-
+
if not func in mod.__dict__:
return False
-
+
if not commands.is_commander_module(mod.__dict__[func]):
return False
-
+
return _resume_command(view, mod.__dict__[func], parts[1:])
@commands.autocomplete(name=commander.commands.completion.command)
def command(view, name):
"""Edit commander command: edit.command <command>"""
parts = name.split('.')
-
+
for mod in sys.modules:
if commands.is_commander_module(sys.modules[mod]) and (mod == parts[0] or _mod_has_alias(sys.modules[mod], parts[0])):
if mod == parts[0]:
ret = _resume_command(view, sys.modules[mod], parts[1:])
else:
ret = _resume_command(view, sys.modules[mod], parts)
-
+
if not ret:
raise commander.commands.exceptions.Execute('Could not find command: ' + name)
else:
return commander.commands.result.HIDE
-
+
raise commander.commands.exceptions.Execute('Could not find command: ' + name)
COMMAND_TEMPLATE="""import commander.commands as commands
@@ -185,9 +185,9 @@ Use this to apply the cool new feature\"\"\"
def new_command(view, entry, name):
"""Create a new commander command module: edit.new-command <command>"""
-
+
filename = os.path.expanduser('~/.gnome2/gedit/commander/modules/' + name + '.py')
-
+
if os.path.isfile(filename):
raise commander.commands.exceptions.Execute('Commander module `' + name + '\' already exists')
@@ -199,7 +199,7 @@ def new_command(view, entry, name):
f = open(filename, 'w')
f.write(COMMAND_TEMPLATE)
f.close()
-
+
return __default__(filename, view)
def save(view):
diff --git a/plugins/commander/modules/find/__init__.py b/plugins/commander/modules/find/__init__.py
index e5bf53b..c955004 100644
--- a/plugins/commander/modules/find/__init__.py
+++ b/plugins/commander/modules/find/__init__.py
@@ -11,17 +11,17 @@ __root__ = ['/', 'find_i', '//', 'r/', 'r//']
class TextFinder(finder.Finder):
def __init__(self, entry, flags):
finder.Finder.__init__(self, entry)
-
+
self.flags = flags
def do_find(self, bounds):
buf = self.view.get_buffer()
-
+
if self.findstr:
buf.set_search_text(self.findstr, self.flags)
-
+
ret = map(lambda x: x.copy(), bounds)
-
+
if buf.search_forward(bounds[0], bounds[1], ret[0], ret[1]):
return ret
else:
diff --git a/plugins/commander/modules/find/finder.py b/plugins/commander/modules/find/finder.py
index bc453f1..02d56a1 100644
--- a/plugins/commander/modules/find/finder.py
+++ b/plugins/commander/modules/find/finder.py
@@ -5,53 +5,53 @@ import commander.utils as utils
class Finder:
FIND_STARTMARK = 'gedit-commander-find-startmark'
FIND_ENDMARK = 'gedit-commander-find-endmark'
-
+
FIND_RESULT_STARTMARK = 'gedit-commander-find-result-startmark'
FIND_RESULT_ENDMARK = 'gedit-commander-find-result-endmark'
-
+
def __init__(self, entry):
self.entry = entry
self.view = entry.view()
-
+
self.findstr = None
self.replacestr = None
self.search_boundaries = utils.Struct({'start': None, 'end': None})
self.find_result = utils.Struct({'start': None, 'end': None})
-
+
self.unescapes = [
['\\n', '\n'],
['\\r', '\r'],
['\\t', '\t']
]
-
+
self.from_start = False
self.search_start_mark = None
-
+
def unescape(self, s):
for esc in self.unescapes:
s = s.replace(esc[0], esc[1])
-
+
return s
-
+
def do_find(self, bounds):
return None
-
+
def get_replace(self, text):
return self.replacestr
-
+
def set_replace(self, replacestr):
self.replacestr = self.unescape(replacestr)
-
+
def set_find(self, findstr):
self.findstr = self.unescape(findstr)
-
+
def select_last_result(self):
buf = self.view.get_buffer()
-
+
startiter = buf.get_iter_at_mark(self.find_result.start)
enditer = buf.get_iter_at_mark(self.find_result.end)
-
+
buf.select_range(startiter, enditer)
visible = self.view.get_visible_rect()
@@ -60,16 +60,16 @@ class Finder:
# Scroll there if needed
if loc.y + loc.height < visible.y or loc.y > visible.y + visible.height:
self.view.scroll_to_iter(startiter, 0.2, True, 0, 0.5)
-
+
def find_next(self, select=False):
buf = self.view.get_buffer()
-
+
# Search from the end of the last result to the end of the search boundary
bounds = [buf.get_iter_at_mark(self.find_result.end),
buf.get_iter_at_mark(self.search_boundaries.end)]
ret = self.do_find(bounds)
-
+
# Check if we need to wrap around if nothing is found
if self.search_start_mark:
startiter = buf.get_iter_at_mark(self.search_start_mark)
@@ -77,59 +77,59 @@ class Finder:
startiter = None
startbound = buf.get_iter_at_mark(self.search_boundaries.start)
-
+
if not ret and not self.from_start and (startiter and not startiter.equal(startbound)):
self.from_start = True
# Try from beginning
bounds[0] = buf.get_start_iter()
bounds[1] = startiter
-
+
# Make sure to just stop at the start of the previous
self.search_boundaries.end = self.search_start_mark
-
+
ret = self.do_find(bounds)
-
+
if not ret:
return False
else:
# Mark find result
buf.move_mark(self.find_result.start, ret[0])
buf.move_mark(self.find_result.end, ret[1])
-
+
if select:
self.select_last_result()
-
+
return True
def _create_or_move(self, markname, piter, left_gravity):
buf = self.view.get_buffer()
mark = buf.get_mark(markname)
-
+
if not mark:
mark = buf.create_mark(markname, piter, left_gravity)
else:
buf.move_mark(mark, piter)
-
+
return mark
def find_first(self, doend=True, select=False):
words = []
buf = self.view.get_buffer()
-
+
while not self.findstr:
fstr, words, modifier = (yield commands.result.Prompt('Find:'))
-
+
if fstr:
self.set_find(fstr)
-
+
# Determine search area
bounds = list(buf.get_selection_bounds())
-
+
if self.search_start_mark:
buf.delete_mark(self.search_start_mark)
self.search_start_mark = None
-
+
if not bounds:
# Search in the whole buffer, from the current cursor position on to the
# end, and then continue to start from the beginning of the buffer if needed
@@ -138,19 +138,19 @@ class Finder:
selection = False
else:
selection = True
-
+
bounds[0].order(bounds[1])
# Set marks at the boundaries
self.search_boundaries.start = self._create_or_move(Finder.FIND_STARTMARK, bounds[0], True)
self.search_boundaries.end = self._create_or_move(Finder.FIND_ENDMARK, bounds[1], False)
-
+
# Set the result marks so the next find will start at the correct location
if selection:
piter = bounds[0]
else:
piter = buf.get_iter_at_mark(buf.get_insert())
-
+
self.find_result.start = self._create_or_move(Finder.FIND_RESULT_STARTMARK, piter, True)
self.find_result.end = self._create_or_move(Finder.FIND_RESULT_ENDMARK, piter, False)
@@ -161,16 +161,16 @@ class Finder:
yield commands.result.DONE
else:
yield True
-
+
def cancel(self):
buf = self.view.get_buffer()
buf.set_search_text('', 0)
buf.move_mark(buf.get_selection_bound(), buf.get_iter_at_mark(buf.get_insert()))
-
+
if self.search_start_mark:
buf.delete_mark(self.search_start_mark)
-
+
def find(self, findstr):
if findstr:
self.set_find(findstr)
@@ -181,7 +181,7 @@ class Finder:
if (yield self.find_first(select=True)):
while True:
argstr, words, modifier = (yield commands.result.Prompt('Search next [<i>%s</i>]:' % (saxutils.escape(self.findstr),)))
-
+
if argstr:
self.set_find(argstr)
@@ -198,12 +198,12 @@ class Finder:
def _restore_cursor(self, mark):
buf = mark.get_buffer()
-
+
buf.place_cursor(buf.get_iter_at_mark(mark))
buf.delete_mark(mark)
-
+
self.view.scroll_to_mark(buf.get_insert(), 0.2, True, 0, 0.5)
-
+
def replace(self, findstr, replaceall=False, replacestr=None):
if findstr:
self.set_find(findstr)
@@ -213,12 +213,12 @@ class Finder:
# First find something
buf = self.view.get_buffer()
-
+
if replaceall:
startmark = buf.create_mark(None, buf.get_iter_at_mark(buf.get_insert()), False)
-
+
ret = (yield self.find_first(select=not replaceall))
-
+
if not ret:
yield commands.result.DONE
@@ -248,7 +248,7 @@ class Finder:
while True:
if not replaceall:
rep, words, modifier = (yield commands.result.Prompt('Replace next [%s]:' % (saxutils.escape(self.replacestr),)))
-
+
if rep:
self.set_replace(rep)
@@ -271,7 +271,7 @@ class Finder:
self.entry.info_show('<i>Search hit end of the document</i>', True)
break
-
+
except GeneratorExit, e:
if replaceall:
self._restore_cursor(startmark)
diff --git a/plugins/commander/modules/find/regex.py b/plugins/commander/modules/find/regex.py
index 4bddf80..ff15d2f 100644
--- a/plugins/commander/modules/find/regex.py
+++ b/plugins/commander/modules/find/regex.py
@@ -10,13 +10,13 @@ __root__ = ['regex_i']
class RegexFinder(finder.Finder):
def __init__(self, entry, flags = 0):
finder.Finder.__init__(self, entry)
-
+
self.flags = re.UNICODE | re.MULTILINE | re.DOTALL | flags
self.groupre = re.compile('(\\\\)?\\$([0-9]+|{(([0-9]+):([^}]+))})')
-
+
def set_find(self, findstr):
finder.Finder.set_find(self, findstr)
-
+
try:
self.findre = re.compile(findstr, self.flags)
except Exception, e:
@@ -24,25 +24,25 @@ class RegexFinder(finder.Finder):
def do_find(self, bounds):
buf = self.view.get_buffer()
-
+
text = bounds[0].get_text(bounds[1])
ret = self.findre.search(text)
-
+
if ret:
start = bounds[0].copy()
start.forward_chars(ret.start())
end = bounds[0].copy()
end.forward_chars(ret.end())
-
+
return [start, end]
else:
return False
-
+
def _transform(self, text, trans):
if not trans:
return text
-
+
transforms = {
'u': lambda x: "%s%s" % (x[0].upper(), x[1:]),
'U': lambda x: x.upper(),
@@ -50,29 +50,29 @@ class RegexFinder(finder.Finder):
'L': lambda x: x.lower(),
't': lambda x: x.title()
}
-
+
for i in trans.split(','):
if i in transforms:
text = transforms[i](text)
-
+
return text
-
+
def _do_re_replace_group(self, matchit, group):
if group.group(3):
num = int(group.group(4))
else:
num = int(group.group(2))
-
+
if group.group(1):
return group.group(2)
elif num < len(matchit.groups()) + 1:
return self._transform(matchit.group(num), group.group(5))
else:
return group.group(0)
-
+
def _do_re_replace(self, matchit):
return self.groupre.sub(lambda x: self._do_re_replace_group(matchit, x), self.replacestr)
-
+
def get_replace(self, text):
try:
return self.findre.sub(self._do_re_replace, text)
diff --git a/plugins/commander/modules/find/test.py b/plugins/commander/modules/find/test.py
index 02d051e..c71e947 100644
--- a/plugins/commander/modules/find/test.py
+++ b/plugins/commander/modules/find/test.py
@@ -11,17 +11,17 @@ __root__ = ['/', 'find_i', '//', 'r/', 'r//']
class TextFinder(finder.Finder):
def __init__(self, entry, flags):
finder.Finder.__init__(self, entry)
-
+
self.flags = flags
def do_find(self, bounds):
buf = self.view.get_buffer()
-
+
if self.findstr:
buf.set_search_text(self.findstr, self.flags)
-
+
ret = map(lambda x: x.copy(), bounds)
-
+
if buf.search_forward(bounds[0], bounds[1], ret[0], ret[1]):
return ret
else:
@@ -69,8 +69,8 @@ Quickly find and replace all phrases in the document (case insensitive)"""
fd = TextFinder(entry,0)
yield fd.replace(argstr, True)
-locals()['/'] = __default__
-locals()['find_i'] = _find_insensitive
-locals()['//'] = replace
-locals()['r/'] = regex.__default__
-locals()['r//'] = regex.replace
+locals()['/'] = __default__
+locals()['find_i'] = _find_insensitive
+locals()['//'] = replace
+locals()['r/'] = regex.__default__
+locals()['r//'] = regex.replace
diff --git a/plugins/commander/modules/goto.py b/plugins/commander/modules/goto.py
index 72ac13c..341d1b7 100644
--- a/plugins/commander/modules/goto.py
+++ b/plugins/commander/modules/goto.py
@@ -22,7 +22,7 @@ def __default__(view, line, column=1):
linnum = citer.get_line() - int(line[1:])
else:
linnum = int(line) - 1
-
+
column = int(column) - 1
except ValueError:
raise commander.commands.exceptions.Execute('Please specify a valid line number')
diff --git a/plugins/commander/modules/help.py b/plugins/commander/modules/help.py
index 155abb6..3aae646 100644
--- a/plugins/commander/modules/help.py
+++ b/plugins/commander/modules/help.py
@@ -15,11 +15,11 @@ def _name_match(first, second):
if len(first) > len(second):
return False
-
+
for i in xrange(0, len(first)):
if not second[i].startswith(first[i]):
return False
-
+
return True
def _doc_text(command, func):
@@ -45,9 +45,9 @@ def __default__(entry, command='help'):
Show detailed information on how to use a certain command (if available)"""
res = commander.commands.completion.command([command], 0)
-
+
if not res:
raise commander.commands.exceptions.Execute('Could not find command: ' + command)
entry.info_show(_doc_text(command, res[0][0]), True)
- return commands.result.DONE
+ return commands.result.DONE
diff --git a/plugins/commander/modules/move.py b/plugins/commander/modules/move.py
index 4a5f753..d47c97c 100644
--- a/plugins/commander/modules/move.py
+++ b/plugins/commander/modules/move.py
@@ -9,7 +9,7 @@ def _move(view, what, num, modifier):
num = int(num)
except:
raise commands.exceptions.Execute('Invalid number: ' + str(num))
-
+
view.emit('move-cursor', what, num, modifier & gtk.gdk.CONTROL_MASK)
return commands.result.HIDE
@@ -45,33 +45,33 @@ Move the cursor per regex (use negative num to move backwards)"""
r = re.compile(regex, re.DOTALL | re.MULTILINE | re.UNICODE)
except Exception, e:
raise commands.exceptions.Execute('Invalid regular expression: ' + str(e))
-
+
try:
num = int(num)
except Exception, e:
raise commands.exceptions.Execute('Invalid number: ' + str(e))
-
+
buf = view.get_buffer()
start = buf.get_iter_at_mark(buf.get_insert())
-
+
if num > 0:
end = buf.get_end_iter()
else:
end = start.copy()
start = buf.get_start_iter()
-
+
text = start.get_text(end)
ret = list(r.finditer(text))
-
+
if num < 0:
ret.reverse()
-
+
idx = min(abs(num), len(ret))
-
+
if idx > 0:
found = ret[idx - 1]
start = buf.get_iter_at_mark(buf.get_insert())
-
+
if num < 0:
start.backward_char(len(text) - found.start(0))
else:
@@ -82,12 +82,12 @@ Move the cursor per regex (use negative num to move backwards)"""
else:
buf.move_mark(buf.get_insert(), start)
buf.move_mark(buf.get_selection_bound(), start)
-
+
visible = view.get_visible_rect()
loc = view.get_iter_location(start)
# Scroll there if needed
if loc.y + loc.height < visible.y or loc.y > visible.y + visible.height:
view.scroll_to_mark(buf.get_insert(), 0.2, True, 0, 0.5)
-
+
return commands.result.HIDE
diff --git a/plugins/commander/modules/reload.py b/plugins/commander/modules/reload.py
index 899155b..fe5a9ee 100644
--- a/plugins/commander/modules/reload.py
+++ b/plugins/commander/modules/reload.py
@@ -16,14 +16,14 @@ does not work correctly."""
# Get the command
res = commander.commands.completion.command([command], 0)
-
+
if not res:
raise commander.commands.exceptions.Execute('Could not find command: ' + command)
mod = res[0][0]
-
+
while not isinstance(mod, commander.commands.module.Module):
mod = mod.parent
-
+
commander.commands.Commands().reload_module(mod)
return commander.commands.result.DONE
\ No newline at end of file
diff --git a/plugins/commander/modules/set.py b/plugins/commander/modules/set.py
index eb03cbe..7e2a6e1 100644
--- a/plugins/commander/modules/set.py
+++ b/plugins/commander/modules/set.py
@@ -8,7 +8,7 @@ __commander_module__ = True
def _complete_options(words, idx):
ret = []
-
+
gb = globals()
for k in gb:
@@ -23,7 +23,7 @@ def _complete_language(words, idx):
ids = manager.get_language_ids()
ids.append('none')
ids.sort()
-
+
return commands.completion.words(ids)(words, idx)
def _complete_use_spaces(words, idx):
@@ -36,10 +36,10 @@ def _complete_draw_spaces(words, idx):
def _complete_value(words, idx):
# Depends a bit on the option
ret, completion = _complete_options(words, idx - 1)
-
+
if not ret:
return None
-
+
completer = '_complete_' + ret[0].replace('-', '_')
gb = globals()
@@ -73,7 +73,7 @@ Set the document language to the language with the specified id"""
manager = gsv.language_manager_get_default()
lang = manager.get_language(language)
-
+
if lang:
view.get_buffer().set_language(lang)
return False
@@ -89,10 +89,10 @@ Set the document tab width"""
width = int(width)
except:
raise commander.commands.exceptions.Execute("Invalid tab width: " + str(width))
-
+
if width <= 0:
raise commander.commands.exceptions.Execute("Invalid tab width: " + str(width))
-
+
view.set_tab_width(width)
return False
@@ -103,10 +103,10 @@ def use_spaces(view, value):
"""Use spaces instead of tabs: set.use-spaces <yes/no>
Set to true/yes to use spaces instead of tabs"""
-
+
setting = value in ('yes', 'true', '1')
view.set_insert_spaces_instead_of_tabs(setting)
-
+
return False
@commands.autocomplete({'*': _complete_draw_spaces})
@@ -123,13 +123,13 @@ for drawing spaces and tabs: <i>set.draw-spaces space tab</i>"""
'nbsp': gsv.DRAW_SPACES_NBSP,
'spaces': gsv.DRAW_SPACES_SPACE
}
-
+
flags = 0
-
+
for arg in args:
for a in m:
if a.startswith(arg):
flags = flags | m[a]
-
+
view.set_draw_spaces(flags)
return False
diff --git a/plugins/commander/modules/shell.py b/plugins/commander/modules/shell.py
index 42e582b..cb4d8b7 100644
--- a/plugins/commander/modules/shell.py
+++ b/plugins/commander/modules/shell.py
@@ -20,14 +20,14 @@ class Process:
self.tmpin = tmpin
self.entry = entry
self.suspend = suspend
-
+
if replace:
self.entry.view().set_editable(False)
if not background:
- fcntl.fcntl(stdout, fcntl.F_SETFL, os.O_NONBLOCK)
+ fcntl.fcntl(stdout, fcntl.F_SETFL, os.O_NONBLOCK)
conditions = glib.IO_IN | glib.IO_PRI | glib.IO_ERR | glib.IO_HUP
-
+
self.watch = glib.io_add_watch(stdout, conditions, self.collect_output)
self._buffer = ''
else:
@@ -35,23 +35,23 @@ class Process:
def update(self):
parts = self._buffer.split("\n")
-
+
for p in parts[:-1]:
self.entry.info_show(p)
-
+
self._buffer = parts[-1]
def collect_output(self, fd, condition):
if condition & (glib.IO_IN | glib.IO_PRI):
try:
ret = fd.read()
-
+
# This seems to happen on OS X...
if ret == '':
condition = condition | glib.IO_HUP
else:
self._buffer += ret
-
+
if not self.replace:
self.update()
except:
@@ -63,9 +63,9 @@ class Process:
if self.replace:
buf = self.entry.view().get_buffer()
buf.begin_user_action()
-
+
bounds = buf.get_selection_bounds()
-
+
if bounds:
buf.delete(bounds[0], bounds[1])
@@ -73,10 +73,10 @@ class Process:
buf.end_user_action()
else:
self.entry.info_show(self._buffer.strip("\n"))
-
+
self.stop()
return False
-
+
return True
def stop(self):
@@ -87,35 +87,35 @@ class Process:
self.pipe.kill()
glib.source_remove(self.watch)
-
+
if self.replace:
self.entry.view().set_editable(True)
-
+
if self.tmpin:
self.tmpin.close()
-
+
sus = self.suspend
self.suspend = None
sus.resume()
def _run_command(entry, replace, background, argstr):
tmpin = None
-
+
cwd = None
doc = entry.view().get_buffer()
-
+
if not doc.is_untitled() and doc.is_local():
gfile = doc.get_location()
cwd = os.path.dirname(gfile.get_path())
-
+
if '<!' in argstr:
bounds = entry.view().get_buffer().get_selection_bounds()
-
+
if not bounds:
bounds = entry.view().get_buffer().get_bounds()
inp = bounds[0].get_text(bounds[1])
-
+
# Write to temporary file
tmpin = tempfile.NamedTemporaryFile(delete=False)
tmpin.write(inp)
@@ -130,17 +130,17 @@ def _run_command(entry, replace, background, argstr):
except Exception, e:
raise commander.commands.exceptions.Execute('Failed to execute: ' + e)
-
+
suspend = None
-
+
if not background:
suspend = commander.commands.result.Suspend()
-
+
proc = Process(entry, p, replace, background, tmpin, stdout, suspend)
if not background:
yield suspend
-
+
# Cancelled or simply done
proc.stop()
diff --git a/plugins/drawspaces/gedit-drawspaces-plugin.c b/plugins/drawspaces/gedit-drawspaces-plugin.c
index 22ad816..f4038c3 100644
--- a/plugins/drawspaces/gedit-drawspaces-plugin.c
+++ b/plugins/drawspaces/gedit-drawspaces-plugin.c
@@ -1,11 +1,11 @@
-/*
+/*
* Copyright (C) 2008 Ignacio Casal Quinteiro <nacho resa gmail com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -58,7 +58,7 @@ struct _GeditDrawspacesPluginPrivate
{
GConfClient *gconf_client;
guint connection_id;
-
+
GtkSourceDrawSpacesFlags flags;
};
@@ -66,7 +66,7 @@ typedef struct
{
GtkActionGroup *action_group;
guint ui_id;
-
+
gboolean enable;
} WindowData;
@@ -81,7 +81,7 @@ typedef struct _DrawspacesConfigureDialog DrawspacesConfigureDialog;
struct _DrawspacesConfigureDialog
{
GtkWidget *dialog;
-
+
GtkWidget *draw_tabs;
GtkWidget *draw_spaces;
GtkWidget *draw_newline;
@@ -130,7 +130,7 @@ set_draw_gconf (GeditDrawspacesPlugin *plugin,
gboolean value)
{
GError *error = NULL;
-
+
gconf_client_set_bool (plugin->priv->gconf_client,
key,
value,
@@ -153,7 +153,7 @@ on_active_toggled (GtkToggleAction *action,
data = (WindowData *) g_object_get_data (G_OBJECT (action_data->window),
WINDOW_DATA_KEY);
g_return_if_fail (data != NULL);
-
+
value = gtk_toggle_action_get_active (action);
data->enable = value;
@@ -166,7 +166,7 @@ static const GtkToggleActionEntry action_entries[] =
{
{ "DrawSpaces", NULL, N_("Show _White Space"), NULL,
N_("Show spaces and tabs"),
- G_CALLBACK (on_active_toggled)},
+ G_CALLBACK (on_active_toggled)},
};
static void on_gconf_notify (GConfClient *client,
@@ -178,7 +178,7 @@ static void
gedit_drawspaces_plugin_init (GeditDrawspacesPlugin *plugin)
{
gedit_debug_message (DEBUG_PLUGINS, "GeditDrawspacesPlugin initializing");
-
+
plugin->priv = GEDIT_DRAWSPACES_PLUGIN_GET_PRIVATE (plugin);
plugin->priv->gconf_client = gconf_client_get_default ();
@@ -187,7 +187,7 @@ gedit_drawspaces_plugin_init (GeditDrawspacesPlugin *plugin)
GCONF_KEY_BASE,
GCONF_CLIENT_PRELOAD_ONELEVEL,
NULL);
-
+
plugin->priv->connection_id = gconf_client_notify_add (plugin->priv->gconf_client,
GCONF_KEY_BASE,
on_gconf_notify,
@@ -205,19 +205,19 @@ gedit_drawspaces_plugin_dispose (GObject *object)
{
gconf_client_notify_remove (plugin->priv->gconf_client,
plugin->priv->connection_id);
-
+
plugin->priv->connection_id = 0;
}
-
+
if (plugin->priv->gconf_client != NULL)
{
gconf_client_suggest_sync (plugin->priv->gconf_client, NULL);
g_object_unref (G_OBJECT (plugin->priv->gconf_client));
-
+
plugin->priv->gconf_client = NULL;
}
-
+
G_OBJECT_CLASS (gedit_drawspaces_plugin_parent_class)->dispose (object);
}
@@ -227,7 +227,7 @@ draw_spaces_in_window (GeditWindow *window,
{
GList *views, *l;
WindowData *data;
-
+
data = (WindowData *) g_object_get_data (G_OBJECT (window),
WINDOW_DATA_KEY);
g_return_if_fail (data != NULL);
@@ -248,7 +248,7 @@ draw_spaces (GeditDrawspacesPlugin *plugin)
const GList *windows, *l;
windows = gedit_app_get_windows (gedit_app_get_default ());
-
+
for (l = windows; l != NULL; l = g_list_next (l))
{
draw_spaces_in_window (l->data, plugin);
@@ -262,11 +262,11 @@ tab_added_cb (GeditWindow *window,
{
GeditView *view;
WindowData *data;
-
+
data = (WindowData *) g_object_get_data (G_OBJECT (window),
WINDOW_DATA_KEY);
g_return_if_fail (data != NULL);
-
+
if (data->enable)
{
view = gedit_tab_get_view (tab);
@@ -343,25 +343,25 @@ get_config_options (WindowData *data,
tabs = get_gconf_value_with_default (plugin, GCONF_KEY_DRAW_TABS,
TRUE);
-
+
spaces = get_gconf_value_with_default (plugin, GCONF_KEY_DRAW_SPACES,
TRUE);
newline = get_gconf_value_with_default (plugin, GCONF_KEY_DRAW_NEWLINE,
FALSE);
-
+
nbsp = get_gconf_value_with_default (plugin, GCONF_KEY_DRAW_NBSP,
FALSE);
- leading = get_gconf_value_with_default (plugin,
+ leading = get_gconf_value_with_default (plugin,
GCONF_KEY_DRAW_LEADING,
TRUE);
- text = get_gconf_value_with_default (plugin,
+ text = get_gconf_value_with_default (plugin,
GCONF_KEY_DRAW_TEXT,
TRUE);
- trailing = get_gconf_value_with_default (plugin,
+ trailing = get_gconf_value_with_default (plugin,
GCONF_KEY_DRAW_TRAILING,
TRUE);
@@ -369,32 +369,32 @@ get_config_options (WindowData *data,
{
plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_TAB;
}
-
+
if (spaces)
{
plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_SPACE;
}
-
+
if (newline)
{
plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_NEWLINE;
}
-
+
if (nbsp)
{
plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_NBSP;
}
-
+
if (leading)
{
plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_LEADING;
}
-
+
if (text)
{
plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_TEXT;
}
-
+
if (trailing)
{
plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_TRAILING;
@@ -418,7 +418,7 @@ impl_activate (GeditPlugin *plugin,
data = g_slice_new (WindowData);
action_data = g_slice_new (ActionData);
-
+
action_data->window = window;
action_data->plugin = ds_plugin;
@@ -427,11 +427,11 @@ impl_activate (GeditPlugin *plugin,
manager = gedit_window_get_ui_manager (window);
data->action_group = gtk_action_group_new ("GeditDrawspacesPluginActions");
- gtk_action_group_set_translation_domain (data->action_group,
+ gtk_action_group_set_translation_domain (data->action_group,
GETTEXT_PACKAGE);
gtk_action_group_add_toggle_actions_full (data->action_group,
action_entries,
- G_N_ELEMENTS (action_entries),
+ G_N_ELEMENTS (action_entries),
action_data,
(GDestroyNotify) free_action_data);
@@ -478,21 +478,21 @@ impl_deactivate (GeditPlugin *plugin,
WindowData *data;
gedit_debug (DEBUG_PLUGINS);
-
+
data = (WindowData *) g_object_get_data (G_OBJECT (window),
WINDOW_DATA_KEY);
g_return_if_fail (data != NULL);
-
+
manager = gedit_window_get_ui_manager (window);
-
+
data->enable = FALSE;
draw_spaces_in_window (window, ds_plugin);
-
+
g_signal_handlers_disconnect_by_func (window, tab_added_cb, ds_plugin);
-
+
gtk_ui_manager_remove_ui (manager, data->ui_id);
gtk_ui_manager_remove_action_group (manager, data->action_group);
-
+
g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL);
}
@@ -500,7 +500,7 @@ static void
on_draw_tabs_toggled (GtkToggleButton *button,
GeditDrawspacesPlugin *plugin)
{
- set_draw_gconf (plugin,
+ set_draw_gconf (plugin,
GCONF_KEY_DRAW_TABS,
gtk_toggle_button_get_active (button));
}
@@ -509,7 +509,7 @@ static void
on_draw_spaces_toggled (GtkToggleButton *button,
GeditDrawspacesPlugin *plugin)
{
- set_draw_gconf (plugin,
+ set_draw_gconf (plugin,
GCONF_KEY_DRAW_SPACES,
gtk_toggle_button_get_active (button));
}
@@ -518,7 +518,7 @@ static void
on_draw_newline_toggled (GtkToggleButton *button,
GeditDrawspacesPlugin *plugin)
{
- set_draw_gconf (plugin,
+ set_draw_gconf (plugin,
GCONF_KEY_DRAW_NEWLINE,
gtk_toggle_button_get_active (button));
}
@@ -527,7 +527,7 @@ static void
on_draw_nbsp_toggled (GtkToggleButton *button,
GeditDrawspacesPlugin *plugin)
{
- set_draw_gconf (plugin,
+ set_draw_gconf (plugin,
GCONF_KEY_DRAW_NBSP,
gtk_toggle_button_get_active (button));
}
@@ -536,7 +536,7 @@ static void
on_draw_leading_toggled (GtkToggleButton *button,
GeditDrawspacesPlugin *plugin)
{
- set_draw_gconf (plugin,
+ set_draw_gconf (plugin,
GCONF_KEY_DRAW_LEADING,
gtk_toggle_button_get_active (button));
}
@@ -545,7 +545,7 @@ static void
on_draw_text_toggled (GtkToggleButton *button,
GeditDrawspacesPlugin *plugin)
{
- set_draw_gconf (plugin,
+ set_draw_gconf (plugin,
GCONF_KEY_DRAW_TEXT,
gtk_toggle_button_get_active (button));
}
@@ -554,7 +554,7 @@ static void
on_draw_trailing_toggled (GtkToggleButton *button,
GeditDrawspacesPlugin *plugin)
{
- set_draw_gconf (plugin,
+ set_draw_gconf (plugin,
GCONF_KEY_DRAW_TRAILING,
gtk_toggle_button_get_active (button));
}
@@ -608,7 +608,7 @@ get_configuration_dialog (GeditDrawspacesPlugin *plugin)
{
GtkWidget *dialog_error;
GtkWidget *content;
-
+
dialog_error = gtk_dialog_new_with_buttons (_("Error dialog"),
NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -617,7 +617,7 @@ get_configuration_dialog (GeditDrawspacesPlugin *plugin)
NULL);
content = gtk_dialog_get_content_area (GTK_DIALOG (dialog_error));
gtk_widget_show (error_widget);
-
+
gtk_box_pack_start_defaults (GTK_BOX (content),
error_widget);
gtk_widget_show (dialog_error);
@@ -666,14 +666,14 @@ static GtkWidget *
impl_create_configure_dialog (GeditPlugin *plugin)
{
DrawspacesConfigureDialog *dialog;
-
+
dialog = get_configuration_dialog (GEDIT_DRAWSPACES_PLUGIN (plugin));
-
+
g_signal_connect (dialog->dialog,
"response",
G_CALLBACK (gtk_widget_destroy),
dialog->dialog);
-
+
return dialog->dialog;
}
@@ -689,7 +689,7 @@ on_gconf_notify (GConfClient *client,
if (strcmp (entry->key, GCONF_KEY_DRAW_TABS) == 0)
{
value = gconf_value_get_bool (entry->value);
-
+
if (value)
{
plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_TAB;
@@ -702,7 +702,7 @@ on_gconf_notify (GConfClient *client,
else if (strcmp (entry->key, GCONF_KEY_DRAW_SPACES) == 0)
{
value = gconf_value_get_bool (entry->value);
-
+
if (value)
{
plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_SPACE;
@@ -715,7 +715,7 @@ on_gconf_notify (GConfClient *client,
else if (strcmp (entry->key, GCONF_KEY_DRAW_NEWLINE) == 0)
{
value = gconf_value_get_bool (entry->value);
-
+
if (value)
{
plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_NEWLINE;
@@ -728,7 +728,7 @@ on_gconf_notify (GConfClient *client,
else if (strcmp (entry->key, GCONF_KEY_DRAW_NBSP) == 0)
{
value = gconf_value_get_bool (entry->value);
-
+
if (value)
{
plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_NBSP;
@@ -741,7 +741,7 @@ on_gconf_notify (GConfClient *client,
else if (strcmp (entry->key, GCONF_KEY_DRAW_LEADING) == 0)
{
value = gconf_value_get_bool (entry->value);
-
+
if (value)
{
plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_LEADING;
@@ -754,7 +754,7 @@ on_gconf_notify (GConfClient *client,
else if (strcmp (entry->key, GCONF_KEY_DRAW_TEXT) == 0)
{
value = gconf_value_get_bool (entry->value);
-
+
if (value)
{
plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_TEXT;
@@ -767,7 +767,7 @@ on_gconf_notify (GConfClient *client,
else if (strcmp (entry->key, GCONF_KEY_DRAW_TRAILING) == 0)
{
value = gconf_value_get_bool (entry->value);
-
+
if (value)
{
plugin->priv->flags |= GTK_SOURCE_DRAW_SPACES_TRAILING;
@@ -777,7 +777,7 @@ on_gconf_notify (GConfClient *client,
plugin->priv->flags &= ~GTK_SOURCE_DRAW_SPACES_TRAILING;
}
}
-
+
draw_spaces (plugin);
}
diff --git a/plugins/drawspaces/gedit-drawspaces-plugin.h b/plugins/drawspaces/gedit-drawspaces-plugin.h
index 249664e..5d2d868 100644
--- a/plugins/drawspaces/gedit-drawspaces-plugin.h
+++ b/plugins/drawspaces/gedit-drawspaces-plugin.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2008 Ignacio Casal Quinteiro <nacho resa gmail com>
*
* This program is free software; you can redistribute it and/or modify
@@ -48,7 +48,7 @@ typedef struct _GeditDrawspacesPlugin GeditDrawspacesPlugin;
struct _GeditDrawspacesPlugin
{
GeditPlugin parent_instance;
-
+
/* private */
GeditDrawspacesPluginPrivate *priv;
};
diff --git a/plugins/joinlines/joinlines.py b/plugins/joinlines/joinlines.py
index 5b283ef..4372e7f 100644
--- a/plugins/joinlines/joinlines.py
+++ b/plugins/joinlines/joinlines.py
@@ -1,19 +1,19 @@
# -*- coding: utf-8 -*-
# Join lines plugin
# This file is part of gedit
-#
+#
# Copyright (C) 2006-2007 Steve Frécinaux, André Homeyer
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330,
@@ -66,7 +66,7 @@ class JoinLinesPlugin(gedit.Plugin):
window.set_data("JoinLinesPluginInfo", data)
update_sensitivity(window)
-
+
def deactivate(self, window):
data = window.get_data("JoinLinesPluginInfo")
manager = window.get_ui_manager()
@@ -77,7 +77,7 @@ class JoinLinesPlugin(gedit.Plugin):
def update_ui(self, window):
update_sensitivity(window)
-
+
def update_sensitivity(window):
data = window.get_data("JoinLinesPluginInfo")
view = window.get_active_view()
@@ -88,11 +88,11 @@ def join_lines(window):
document = window.get_active_document()
if document is None:
return
-
+
document.begin_user_action()
# If there is a selection use it, otherwise join the
- # next line
+ # next line
try:
start, end = document.get_selection_bounds()
except ValueError:
@@ -108,7 +108,7 @@ def join_lines(window):
while document.get_iter_at_mark(end_mark).compare(start) == 1:
end = start.copy()
while end.get_char() in ('\r', '\n', ' ', '\t'):
- end.forward_char()
+ end.forward_char()
document.delete(start, end)
document.insert(start, ' ')
@@ -160,18 +160,18 @@ def split_lines(window):
end_mark = document.create_mark(None, end)
- # ignore first word
+ # ignore first word
previous_word_end = start.copy()
forward_to_word_start(previous_word_end)
forward_to_word_end(previous_word_end)
- while 1:
+ while 1:
current_word_start = previous_word_end.copy()
forward_to_word_start(current_word_start)
-
+
current_word_end = current_word_start.copy()
forward_to_word_end(current_word_end)
-
+
if ord(current_word_end.get_char()) and \
document.get_iter_at_mark(end_mark).compare(current_word_end) >= 0:
@@ -181,11 +181,11 @@ def split_lines(window):
document.delete(previous_word_end, current_word_start)
line_offset = get_line_offset(current_word_start, tabwidth) + word_length
- if line_offset > width - 1:
+ if line_offset > width - 1:
document.insert(current_word_start, '\n' + indent)
else:
document.insert(current_word_start, ' ')
-
+
previous_word_end = current_word_start.copy()
previous_word_end.forward_chars(word_length)
else:
@@ -208,13 +208,13 @@ def get_line_offset(text_iter, tabwidth):
offset_iter.forward_char()
return line_offset
-
+
def forward_to_word_start(text_iter):
char = text_iter.get_char()
while ord(char) and (char in (' ', '\t', '\n', '\r')):
text_iter.forward_char()
char = text_iter.get_char()
-
+
def forward_to_word_end(text_iter):
char = text_iter.get_char()
while ord(char) and (not (char in (' ', '\t', '\n', '\r'))):
diff --git a/plugins/multiedit/multiedit/__init__.py b/plugins/multiedit/multiedit/__init__.py
index a170127..25fbacc 100644
--- a/plugins/multiedit/multiedit/__init__.py
+++ b/plugins/multiedit/multiedit/__init__.py
@@ -1,19 +1,19 @@
# -*- coding: utf-8 -*-
#
# multiedit.py - Multi Edit
-#
+#
# Copyright (C) 2009 - Jesse van den Kieboom
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330,
@@ -29,7 +29,7 @@ class MultiEditPlugin(gedit.Plugin):
def activate(self, window):
self._instances[window] = WindowHelper(self, window)
-
+
def deactivate(self, window):
if window in self._instances:
self._instances[window].deactivate()
diff --git a/plugins/multiedit/multiedit/constants.py b/plugins/multiedit/multiedit/constants.py
index 15647d9..143b0e8 100644
--- a/plugins/multiedit/multiedit/constants.py
+++ b/plugins/multiedit/multiedit/constants.py
@@ -1,19 +1,19 @@
# -*- coding: utf-8 -*-
#
# constants.py - Multi Edit
-#
+#
# Copyright (C) 2009 - Jesse van den Kieboom
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330,
diff --git a/plugins/multiedit/multiedit/documenthelper.py b/plugins/multiedit/multiedit/documenthelper.py
index 0909e97..f5fdf6b 100644
--- a/plugins/multiedit/multiedit/documenthelper.py
+++ b/plugins/multiedit/multiedit/documenthelper.py
@@ -63,7 +63,7 @@ class DocumentHelper(Signals):
self.connect_signal(self._view, 'copy-clipboard', self.on_copy_clipboard)
self.connect_signal(self._view, 'cut-clipboard', self.on_cut_clipboard)
self.connect_signal(self._view, 'query-tooltip', self.on_query_tooltip)
-
+
self._view.props.has_tooltip = True
self.reset_buffer(self._view.get_buffer())
@@ -127,11 +127,11 @@ class DocumentHelper(Signals):
self.disconnect_signals(self._view)
self._view = None
-
+
if self._status_timeout != 0:
glib.source_remove(self._status_timeout)
self._status_timeout = 0
-
+
if self._delete_mode_id != 0:
glib.source_remove(self._delete_mode_id)
self._delete_mode_id = 0
@@ -287,11 +287,11 @@ class DocumentHelper(Signals):
def _add_edit_point(self, piter):
# Check if there is already an edit point here
marks = piter.get_marks()
-
+
for mark in marks:
if mark in self._edit_points:
return
-
+
buf = self._buffer
mark = buf.create_mark(None, piter, True)
mark.set_visible(True)
@@ -301,7 +301,7 @@ class DocumentHelper(Signals):
def _remove_duplicate_edit_points(self):
buf = self._buffer
-
+
for mark in list(self._edit_points):
if mark.get_deleted():
continue
@@ -310,14 +310,14 @@ class DocumentHelper(Signals):
others = piter.get_marks()
others.remove(mark)
-
+
for other in others:
if other in self._edit_points:
buf.delete_mark(other)
self._edit_points.remove(other)
-
+
marks = buf.get_iter_at_mark(buf.get_insert()).get_marks()
-
+
for mark in marks:
if mark in self._edit_points:
buf.delete_mark(mark)
@@ -334,7 +334,7 @@ class DocumentHelper(Signals):
def _remove_status(self):
self._status = None
self._invalidate_status()
-
+
self._status_timeout = 0
return False
@@ -342,13 +342,13 @@ class DocumentHelper(Signals):
if not self._in_mode:
self._status = None
return
-
+
self._status = text
self._invalidate_status()
-
+
if self._status_timeout != 0:
glib.source_remove(self._status_timeout)
-
+
self._status_timeout = glib.timeout_add(3000, self._remove_status)
def _apply_column_mode(self):
@@ -429,7 +429,7 @@ class DocumentHelper(Signals):
# Remove official selection
insert = buf.get_iter_at_mark(buf.get_insert())
buf.move_mark(buf.get_selection_bound(), insert)
-
+
# Remove previous marks
self.remove_edit_points()
@@ -489,7 +489,7 @@ class DocumentHelper(Signals):
ctx.rectangle(rx, y, rw, height)
ctx.fill()
-
+
return False
def do_mark_start_end(self, test, move):
@@ -514,51 +514,51 @@ class DocumentHelper(Signals):
if not start.forward_line():
break
-
+
return orig, end
def do_mark_start(self, event):
start, end = self.do_mark_start_end(None, lambda x: x.set_line_offset(0))
-
+
start.backward_line()
-
+
buf = self._buffer
buf.move_mark(buf.get_insert(), start)
buf.move_mark(buf.get_selection_bound(), start)
-
+
return True
def do_mark_end(self, event):
start, end = self.do_mark_start_end(lambda x: x.ends_line(), lambda x: x.forward_to_line_end())
-
+
end.forward_line()
-
+
if not end.ends_line():
end.forward_to_line_end()
-
+
buf = self._buffer
buf.move_mark(buf.get_insert(), end)
buf.move_mark(buf.get_selection_bound(), end)
return True
-
+
def do_toggle_edit_point(self, event):
buf = self._buffer
piter = buf.get_iter_at_mark(buf.get_insert())
-
+
marks = piter.get_marks()
-
+
for mark in marks:
if mark in self._edit_points:
buf.delete_mark(mark)
self._edit_points.remove(mark)
-
+
self.status('<i>%s</i>' % (xml.sax.saxutils.escape(_('Removed edit point...'),)))
return
-
+
self._add_edit_point(piter)
return True
-
+
def on_key_press_event(self, view, event):
defmod = gtk.accelerator_get_default_mod_mask() & event.state
@@ -597,7 +597,7 @@ class DocumentHelper(Signals):
# Insert the text at all the edit points
for mark in self._edit_points:
piter = buf.get_iter_at_mark(mark)
-
+
if not buf.get_iter_at_mark(buf.get_insert()).equal(piter):
self._multi_edited = True
buf.insert(piter, text)
@@ -608,11 +608,11 @@ class DocumentHelper(Signals):
if hasattr(where, 'assign'):
where.assign(iterwas)
-
+
if atinsert:
buf.move_mark(buf.get_insert(), iterwas)
buf.move_mark(buf.get_selection_bound(), iterwas)
-
+
buf.delete_mark(wasat)
buf.end_user_action()
self.unblock_signal(buf, 'insert-text')
@@ -675,7 +675,7 @@ class DocumentHelper(Signals):
for mark in self._edit_points:
piter = buf.get_iter_at_mark(mark)
other = piter.copy()
-
+
if self._is_backspace:
# Remove 'delete_length' chars _before_ piter
if not other.backward_chars(self._delete_length):
@@ -694,10 +694,10 @@ class DocumentHelper(Signals):
buf.end_user_action()
self.unblock_signal(buf, 'delete-range')
-
+
piter = buf.get_iter_at_mark(orig)
buf.delete_mark(orig)
-
+
# To be able to have it not crash with old pygtk
if hasattr(start, 'assign'):
start.assign(piter)
@@ -715,28 +715,28 @@ class DocumentHelper(Signals):
bounds = buf.get_bounds()
buf.remove_tag(self._selection_tag, bounds[0], bounds[1])
-
+
self.status('<i>%s</i>' % (xml.sax.saxutils.escape(_('Cancelled column mode...'),)))
self._view.queue_draw()
def _column_text(self):
if not self._column_mode:
return ''
-
+
start = self._column_mode[0]
end = self._column_mode[1]
buf = self._buffer
cstart = self._column_mode[2]
cend = self._column_mode[3]
-
+
lines = []
width = cend - cstart
while start <= end:
start_iter, soff = self.get_visible_iter(start, cstart)
end_iter, eoff = self.get_visible_iter(start, cend)
-
+
if soff == 0 and eoff == 0:
# Just text
lines.append(start_iter.get_text(end_iter))
@@ -755,32 +755,32 @@ class DocumentHelper(Signals):
lines.append(start_iter.get_text(end_iter) + (' ' * abs(eoff)))
else:
lines.append('')
-
+
start += 1
-
+
return "\n".join(lines)
def on_copy_clipboard(self, view):
if not self._column_mode:
return
-
+
text = self._column_text()
clipboard = gtk.Clipboard(self._view.get_display())
clipboard.set_text(text)
-
+
view.stop_emission('copy-clipboard')
-
+
def on_cut_clipboard(self, view):
if not self._column_mode:
return
-
+
text = self._column_text()
clipboard = gtk.Clipboard(self._view.get_display())
clipboard.set_text(text)
-
+
view.stop_emission('cut-clipboard')
-
+
self._apply_column_mode()
def on_mark_set(self, buf, where, mark):
@@ -793,7 +793,7 @@ class DocumentHelper(Signals):
self._cancel_column_mode()
elif self._edit_points and self._multi_edited:
# Detect moving up or down a line
-
+
diff = where.get_offset() - buf.get_iter_at_mark(self._last_insert).get_offset()
for point in self._edit_points:
@@ -808,14 +808,14 @@ class DocumentHelper(Signals):
def on_view_undo(self, view):
self._cancel_column_mode()
self.remove_edit_points()
-
+
def make_label(self, text):
lbl = gtk.Label(text)
lbl.set_alignment(0, 0.5)
lbl.show()
-
+
return lbl
-
+
def on_query_tooltip(self, view, x, y, keyboard_mode, tooltip):
if not self._in_mode:
return False
@@ -833,12 +833,12 @@ class DocumentHelper(Signals):
table.attach(self.make_label('<Ctrl>+E:'), 0, 1, 1, 2, gtk.SHRINK | gtk.FILL, gtk.SHRINK | gtk.FILL)
table.attach(self.make_label('<Ctrl><Home>:'), 0, 1, 2, 3, gtk.SHRINK | gtk.FILL, gtk.SHRINK | gtk.FILL)
table.attach(self.make_label('<Ctrl><End>:'), 0, 1, 3, 4, gtk.SHRINK | gtk.FILL, gtk.SHRINK | gtk.FILL)
-
+
table.attach(self.make_label(_('Enter column edit mode using selection')), 1, 2, 0, 1)
table.attach(self.make_label(_('Toggle edit point')), 1, 2, 1, 2)
table.attach(self.make_label(_('Add edit point at beginning of line/selection')), 1, 2, 2, 3)
table.attach(self.make_label(_('Add edit point at end of line/selection')), 1, 2, 3, 4)
-
+
table.show_all()
tooltip.set_custom(table)
return True
@@ -884,7 +884,7 @@ class DocumentHelper(Signals):
ctx.set_line_width(1)
col = self.from_color(view.get_style().text[view.state])
-
+
ctx.set_source_rgba(col[0], col[1], col[2], 0.6)
ctx.move_to(geom[0], geom[1] + geom[3] - 1)
ctx.rel_line_to(geom[2], 0)
@@ -893,7 +893,7 @@ class DocumentHelper(Signals):
ctx.set_source_rgb(col[0], col[1], col[2])
ctx.move_to(geom[2] - extents[1][2] - 3, (geom[3] - extents[1][3]) / 2)
ctx.show_layout(layout)
-
+
if not self._status:
status = ''
else:
@@ -901,7 +901,7 @@ class DocumentHelper(Signals):
if status:
layout.set_markup(status)
-
+
ctx.move_to(3, (geom[3] - extents[1][3]) / 2)
ctx.show_layout(layout)
diff --git a/plugins/multiedit/multiedit/signals.py b/plugins/multiedit/multiedit/signals.py
index 654f29b..286b692 100644
--- a/plugins/multiedit/multiedit/signals.py
+++ b/plugins/multiedit/multiedit/signals.py
@@ -1,19 +1,19 @@
# -*- coding: utf-8 -*-
#
# signals.py - Multi Edit
-#
+#
# Copyright (C) 2009 - Jesse van den Kieboom
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330,
@@ -25,7 +25,7 @@ class Signals:
def _connect(self, obj, name, handler, connector):
ret = self._signals.setdefault(obj, {})
-
+
hid = connector(name, handler)
ret.setdefault(name, []).append(hid)
@@ -33,10 +33,10 @@ class Signals:
def connect_signal(self, obj, name, handler):
return self._connect(obj, name, handler, obj.connect)
-
+
def connect_signal_after(self, obj, name, handler):
return self._connect(obj, name, handler, obj.connect_after)
-
+
def disconnect_signals(self, obj):
if not obj in self._signals:
return False
@@ -44,49 +44,49 @@ class Signals:
for name in self._signals[obj]:
for hid in self._signals[obj][name]:
obj.disconnect(hid)
-
+
del self._signals[obj]
return True
-
+
def block_signal(self, obj, name):
if not obj in self._signals:
return False
-
+
if not name in self._signals[obj]:
return False
-
+
for hid in self._signals[obj][name]:
obj.handler_block(hid)
-
+
return True
-
+
def unblock_signal(self, obj, name):
if not obj in self._signals:
return False
-
+
if not name in self._signals[obj]:
return False
-
+
for hid in self._signals[obj][name]:
obj.handler_unblock(hid)
-
+
return True
def disconnect_signal(self, obj, name):
if not obj in self._signals:
return False
-
+
if not name in self._signals[obj]:
return False
-
+
for hid in self._signals[obj][name]:
obj.disconnect(hid)
-
+
del self._signals[obj][name]
-
+
if len(self._signals[obj]) == 0:
del self._signals[obj]
-
+
return True
# ex:ts=4:et:
diff --git a/plugins/multiedit/multiedit/windowhelper.py b/plugins/multiedit/multiedit/windowhelper.py
index adae3af..9dc7969 100644
--- a/plugins/multiedit/multiedit/windowhelper.py
+++ b/plugins/multiedit/multiedit/windowhelper.py
@@ -1,19 +1,19 @@
# -*- coding: utf-8 -*-
#
# windowhelper.py - Multi Edit
-#
+#
# Copyright (C) 2009 - Jesse van den Kieboom
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330,
@@ -48,14 +48,14 @@ ui_str = """
class WindowHelper(Signals):
def __init__(self, plugin, window):
Signals.__init__(self)
-
+
self._window = window
self._plugin = plugin
-
+
# Insert document helpers
for view in window.get_views():
self.add_document_helper(view)
-
+
self.connect_signal(window, 'tab-added', self.on_tab_added)
self.connect_signal(window, 'tab-removed', self.on_tab_removed)
self.connect_signal(window, 'active-tab-changed', self.on_active_tab_changed)
@@ -64,11 +64,11 @@ class WindowHelper(Signals):
def install_ui(self):
manager = self._window.get_ui_manager()
-
+
self._action_group = gtk.ActionGroup("GeditMultiEditPluginActions")
self._action_group.add_toggle_actions(
[('MultiEditModeAction', None, _('Multi Edit Mode'), '<Ctrl><Shift>C', _('Start multi edit mode'), self.on_multi_edit_mode)])
-
+
manager.insert_action_group(self._action_group, -1)
self._merge_id = manager.add_ui_from_string(ui_str)
@@ -76,7 +76,7 @@ class WindowHelper(Signals):
manager = self._window.get_ui_manager()
manager.remove_ui(self._merge_id)
manager.remove_action_group(self._action_group)
-
+
manager.ensure_update()
def deactivate(self):
@@ -88,7 +88,7 @@ class WindowHelper(Signals):
self.uninstall_ui()
self._window = None
- self._plugin = None
+ self._plugin = None
def update_ui(self):
pass
@@ -102,7 +102,7 @@ class WindowHelper(Signals):
def remove_document_helper(self, view):
helper = view.get_data(constants.DOCUMENT_HELPER_KEY)
-
+
if helper != None:
helper.stop()
@@ -115,7 +115,7 @@ class WindowHelper(Signals):
def on_tab_added(self, window, tab):
self.add_document_helper(tab.get_view())
-
+
def on_tab_removed(self, window, tab):
self.remove_document_helper(tab.get_view())
@@ -128,7 +128,7 @@ class WindowHelper(Signals):
def on_multi_edit_mode(self, action):
view = self._window.get_active_view()
helper = view.get_data(constants.DOCUMENT_HELPER_KEY)
-
+
if helper != None:
helper.toggle_multi_edit(self.get_action().get_active())
diff --git a/plugins/sessionsaver/__init__.py b/plugins/sessionsaver/__init__.py
index f269168..560dc65 100644
--- a/plugins/sessionsaver/__init__.py
+++ b/plugins/sessionsaver/__init__.py
@@ -16,7 +16,7 @@
#
# You should have received a copy of the GNU General Public License
# along with gedit Session Saver Plugin; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA
import gobject
@@ -142,11 +142,11 @@ class SessionSaverPlugin(gedit.Plugin):
def update_ui(self, window):
window.get_data(self.WINDOW_DATA_KEY).update_ui()
-
+
def update_session_menu(self):
for window in gedit.app_get_default().get_windows():
window.get_data(self.WINDOW_DATA_KEY).update_session_menu()
-
+
def load_session(self, session, window = None):
# Note: a session has to stand on its own window.
app = gedit.app_get_default()
diff --git a/plugins/sessionsaver/dialogs.py b/plugins/sessionsaver/dialogs.py
index 4785cdb..cdf1df0 100644
--- a/plugins/sessionsaver/dialogs.py
+++ b/plugins/sessionsaver/dialogs.py
@@ -33,7 +33,7 @@ class SessionModel(gtk.GenericTreeModel):
def on_session_added(self, store, session):
piter = store.index(session)
self.row_inserted(self.on_get_path(piter), piter)
-
+
def on_session_changed(self, store, session):
piter = store.index(session)
self.row_changed(self.on_get_path(piter), piter)
@@ -41,7 +41,7 @@ class SessionModel(gtk.GenericTreeModel):
def on_session_removed(self, store, session):
piter = store.index(session)
self.row_deleted(self.on_get_path(piter))
-
+
def on_get_flags(self):
return gtk.TREE_MODEL_LIST_ONLY
diff --git a/plugins/sessionsaver/store.py b/plugins/sessionsaver/store.py
index 9b9077a..2925e4d 100644
--- a/plugins/sessionsaver/store.py
+++ b/plugins/sessionsaver/store.py
@@ -16,7 +16,7 @@
#
# You should have received a copy of the GNU General Public License
# along with gedit Session Saver Plugin; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA
import os.path
@@ -59,10 +59,10 @@ class SessionStore(gobject.GObject):
def __iter__(self):
return iter(self._sessions)
-
+
def __getitem__(self, index):
return self._sessions[index]
-
+
def __getslice__(self, i, j):
return self._sessions[i:j]
@@ -72,7 +72,7 @@ class SessionStore(gobject.GObject):
def do_session_added(self, session):
self._sessions.append(session)
self._sessions.sort()
-
+
def do_session_changed(self, session):
index = self._sessions.index(session)
self._sessions[index] = session
@@ -84,10 +84,10 @@ class SessionStore(gobject.GObject):
self.emit('session-changed', session)
else:
self.emit('session-added', session)
-
+
def do_session_removed(self, session):
self._sessions.remove(session)
-
+
def remove(self, session):
assert isinstance(session, Session)
if session in self:
@@ -131,7 +131,7 @@ class XMLSessionStore(SessionStore):
def load(self):
if not os.path.isfile(self.filename):
return
-
+
parser = expat.ParserCreate('UTF-8')
parser.buffer_text = True
parser.StartElementHandler = self._expat_start_handler
@@ -148,7 +148,7 @@ class XMLSessionStore(SessionStore):
elif tag == 'session':
assert self._current_session is None
self._current_session = Session(attr['name'])
-
+
def _expat_end_handler(self, tag):
if tag == 'session':
self.add(self._current_session)
diff --git a/plugins/showtabbar/gedit-show-tabbar-plugin.c b/plugins/showtabbar/gedit-show-tabbar-plugin.c
index 306d1c2..3b4d42c 100644
--- a/plugins/showtabbar/gedit-show-tabbar-plugin.c
+++ b/plugins/showtabbar/gedit-show-tabbar-plugin.c
@@ -1,13 +1,13 @@
/*
* gedit-show-tabbar-plugin.c
- *
+ *
* Copyright (C) 2006 Steve Frécinaux
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -67,19 +67,19 @@ gconf_load_tabbar_visible (void)
{
GConfClient *client;
GConfValue *value;
-
+
client = gconf_client_get_default ();
value = gconf_client_get (client,
GCONF_BASE_KEY "/tabbar_visible",
NULL);
-
+
g_object_unref (client);
-
+
if (value != NULL)
{
gboolean visible;
-
+
visible = (value->type == GCONF_VALUE_BOOL)
? gconf_value_get_bool (value)
: TRUE;
@@ -91,7 +91,7 @@ gconf_load_tabbar_visible (void)
{
return TRUE; /* default value */
}
-}
+}
static void
gconf_store_tabbar_visible (gboolean visible)
@@ -104,7 +104,7 @@ gconf_store_tabbar_visible (gboolean visible)
GCONF_BASE_KEY "/tabbar_visible",
visible,
NULL);
-
+
g_object_unref (client);
}
@@ -116,32 +116,32 @@ get_notebook (GeditWindow *window)
GtkNotebook *notebook;
g_return_val_if_fail (window != NULL, NULL);
-
+
container = GTK_CONTAINER (gtk_bin_get_child (GTK_BIN (window)));
/* VBox */
-
+
list = gtk_container_get_children (container);
container = GTK_CONTAINER (g_list_nth_data (list, 2)); /* HPaned */
g_list_free (list);
-
+
list = gtk_container_get_children (container);
container = GTK_CONTAINER (g_list_nth_data (list, 1)); /* VPaned */
g_list_free (list);
-
+
list = gtk_container_get_children (container);
notebook = GTK_NOTEBOOK (g_list_nth_data (list, 0)); /* Notebook */
g_list_free (list);
-
+
return notebook;
}
static void
-on_notebook_show_tabs_changed (GtkNotebook *notebook,
+on_notebook_show_tabs_changed (GtkNotebook *notebook,
GParamSpec *pspec,
GtkToggleAction *action)
{
gboolean visible;
-
+
#if 0
/* this works quite bad due to update_tabs_visibility in
gedit-notebook.c */
@@ -173,7 +173,7 @@ static void
free_window_data (WindowData *data)
{
g_return_if_fail (data != NULL);
-
+
g_object_unref (data->action_group);
g_free (data);
}
@@ -195,7 +195,7 @@ impl_activate (GeditPlugin *plugin,
notebook = get_notebook (window);
gtk_notebook_set_show_tabs (notebook, visible);
-
+
data = g_new (WindowData, 1);
manager = gedit_window_get_ui_manager (window);
@@ -207,7 +207,7 @@ impl_activate (GeditPlugin *plugin,
action = gtk_toggle_action_new ("ShowTabbar",
_("Tab_bar"),
_("Show or hide the tabbar in the current window"),
- NULL);
+ NULL);
gtk_toggle_action_set_active (action, visible);
@@ -215,7 +215,7 @@ impl_activate (GeditPlugin *plugin,
"toggled",
G_CALLBACK (on_view_tabbar_toggled),
window);
-
+
gtk_action_group_add_action (data->action_group, GTK_ACTION (action));
gtk_ui_manager_insert_action_group (manager, data->action_group, -1);
@@ -230,12 +230,12 @@ impl_activate (GeditPlugin *plugin,
GTK_UI_MANAGER_MENUITEM,
TRUE);
- data->signal_handler_id =
+ data->signal_handler_id =
g_signal_connect (notebook,
"notify::show-tabs",
G_CALLBACK (on_notebook_show_tabs_changed),
action);
-
+
g_object_set_data_full (G_OBJECT (window),
WINDOW_DATA_KEY,
data,
@@ -259,7 +259,7 @@ impl_deactivate (GeditPlugin *plugin,
gtk_ui_manager_remove_ui (manager, data->ui_id);
gtk_ui_manager_remove_action_group (manager, data->action_group);
-
+
g_signal_handler_disconnect (get_notebook (window),
data->signal_handler_id);
diff --git a/plugins/showtabbar/gedit-show-tabbar-plugin.h b/plugins/showtabbar/gedit-show-tabbar-plugin.h
index 1b0356d..f24a067 100644
--- a/plugins/showtabbar/gedit-show-tabbar-plugin.h
+++ b/plugins/showtabbar/gedit-show-tabbar-plugin.h
@@ -1,6 +1,6 @@
/*
* gedit-show-tabbar-plugin.h
- *
+ *
* Copyright (C) 2006 Steve Frécinaux
*
* This program is free software; you can redistribute it and/or modify
diff --git a/plugins/smartspaces/smartspaces.py b/plugins/smartspaces/smartspaces.py
index adcc255..0a5c424 100644
--- a/plugins/smartspaces/smartspaces.py
+++ b/plugins/smartspaces/smartspaces.py
@@ -1,19 +1,19 @@
# -*- coding: utf-8 -*-
# smartspaces.py
-#
+#
# Copyright (C) 2006 - Steve Frécinaux
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330,
@@ -60,14 +60,14 @@ class SmartSpacesViewHelper(object):
if event.keyval != gtk.keysyms.BackSpace or \
event.state & mods != 0 and event.state & mods != gtk.gdk.SHIFT_MASK:
return False
-
+
doc = view.get_buffer()
if doc.get_has_selection():
return False
-
+
cur = doc.get_iter_at_mark(doc.get_insert())
offset = cur.get_line_offset()
-
+
if offset == 0:
# We're at the begining of the line, so we can't obviously
# unindent in this case
@@ -77,7 +77,7 @@ class SmartSpacesViewHelper(object):
prev = cur.copy()
prev.backward_char()
- # If the previus chars are spaces, try to remove
+ # If the previus chars are spaces, try to remove
# them until the previus tab stop
max_move = offset % view.get_tab_width()
if max_move == 0:
@@ -90,12 +90,12 @@ class SmartSpacesViewHelper(object):
if not prev.backward_char():
# we reached the start of the buffer
break
-
+
if moved == 0:
# The iterator hasn't moved, it was not a space
return False
- # Actually delete the spaces
+ # Actually delete the spaces
doc.begin_user_action()
doc.delete(start, cur)
doc.end_user_action()
@@ -111,7 +111,7 @@ class SmartSpacesPlugin(gedit.Plugin):
def add_helper(self, view):
helper = SmartSpacesViewHelper(view)
view.set_data(self.VIEW_DATA_KEY, helper)
-
+
def remove_helper(self, view):
view.get_data(self.VIEW_DATA_KEY).deactivate()
view.set_data(self.VIEW_DATA_KEY, None)
@@ -119,16 +119,16 @@ class SmartSpacesPlugin(gedit.Plugin):
def activate(self, window):
for view in window.get_views():
self.add_helper(view)
-
+
handler_id = window.connect("tab-added",
lambda w, t: self.add_helper(t.get_view()))
window.set_data(self.WINDOW_DATA_KEY, handler_id)
-
+
def deactivate(self, window):
handler_id = window.get_data(self.WINDOW_DATA_KEY)
window.disconnect(handler_id)
window.set_data(self.WINDOW_DATA_KEY, None)
-
+
for view in window.get_views():
self.remove_helper(view)
diff --git a/plugins/wordcompletion/gedit-word-completion-plugin.c b/plugins/wordcompletion/gedit-word-completion-plugin.c
index 438d320..53fee50 100644
--- a/plugins/wordcompletion/gedit-word-completion-plugin.c
+++ b/plugins/wordcompletion/gedit-word-completion-plugin.c
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2009 Ignacio Casal Quinteiro <icq gnome org>
* 2009 Jesse van den Kieboom <jesse gnome org>
*
@@ -6,7 +6,7 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -69,10 +69,10 @@ add_view (WindowData *data,
{
GtkSourceCompletion *completion;
GtkTextBuffer *buf;
-
+
completion = gtk_source_view_get_completion (view);
buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
-
+
gtk_source_completion_add_provider (completion,
GTK_SOURCE_COMPLETION_PROVIDER (data->provider),
NULL);
@@ -86,10 +86,10 @@ remove_view (WindowData *data,
{
GtkSourceCompletion *completion;
GtkTextBuffer *buf;
-
+
completion = gtk_source_view_get_completion (view);
buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
-
+
gtk_source_completion_remove_provider (completion,
GTK_SOURCE_COMPLETION_PROVIDER (data->provider),
NULL);
@@ -104,11 +104,11 @@ tab_added_cb (GeditWindow *window,
{
GeditView *view;
WindowData *data;
-
+
data = (WindowData *) g_object_get_data (G_OBJECT (window),
WINDOW_DATA_KEY);
g_return_if_fail (data != NULL);
-
+
view = gedit_tab_get_view (tab);
add_view (data, GTK_SOURCE_VIEW (view));
@@ -121,11 +121,11 @@ tab_removed_cb (GeditWindow *window,
{
GeditView *view;
WindowData *data;
-
+
data = (WindowData *) g_object_get_data (G_OBJECT (window),
WINDOW_DATA_KEY);
g_return_if_fail (data != NULL);
-
+
view = gedit_tab_get_view (tab);
remove_view (data, GTK_SOURCE_VIEW (view));
@@ -173,7 +173,7 @@ impl_deactivate (GeditPlugin *plugin,
GList *views, *l;
gedit_debug (DEBUG_PLUGINS);
-
+
data = (WindowData *) g_object_get_data (G_OBJECT (window),
WINDOW_DATA_KEY);
g_return_if_fail (data != NULL);
@@ -186,7 +186,7 @@ impl_deactivate (GeditPlugin *plugin,
g_signal_handler_disconnect (window, data->tab_added_id);
g_signal_handler_disconnect (window, data->tab_removed_id);
-
+
g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL);
}
diff --git a/plugins/wordcompletion/gedit-word-completion-plugin.h b/plugins/wordcompletion/gedit-word-completion-plugin.h
index 58fb01b..dfea005 100644
--- a/plugins/wordcompletion/gedit-word-completion-plugin.h
+++ b/plugins/wordcompletion/gedit-word-completion-plugin.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2009 Ignacio Casal Quinteiro <icq gnome org>
*
* This program is free software; you can redistribute it and/or modify
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]