renaming from gedit to pluma
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import gtksourceview2 as gsv
|
||||
import gobject
|
||||
import gedit
|
||||
import pluma
|
||||
import gtk
|
||||
|
||||
from Library import Library
|
||||
@@ -102,7 +102,7 @@ class Provider(gobject.GObject, gsv.CompletionProvider):
|
||||
|
||||
def do_get_info_widget(self, proposal):
|
||||
if not self.info_widget:
|
||||
view = gedit.View(gedit.Document())
|
||||
view = pluma.View(pluma.Document())
|
||||
manager = get_language_manager()
|
||||
|
||||
lang = manager.get_language('snippets')
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Gedit snippets plugin
|
||||
# Pluma snippets plugin
|
||||
# Copyright (C) 2005-2006 Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@@ -21,7 +21,7 @@ import re
|
||||
import gtk
|
||||
from gtk import gdk
|
||||
import gio
|
||||
import gedit
|
||||
import pluma
|
||||
import gtksourceview2 as gsv
|
||||
import gobject
|
||||
|
||||
@@ -433,7 +433,7 @@ class Document:
|
||||
def env_get_documents_uri(self, buf):
|
||||
toplevel = self.view.get_toplevel()
|
||||
|
||||
if isinstance(toplevel, gedit.Window):
|
||||
if isinstance(toplevel, pluma.Window):
|
||||
documents_uri = [doc.get_location().get_uri()
|
||||
for doc in toplevel.get_documents()
|
||||
if doc.get_location() is not None]
|
||||
@@ -445,14 +445,14 @@ class Document:
|
||||
def env_get_documents_path(self, buf):
|
||||
toplevel = self.view.get_toplevel()
|
||||
|
||||
if isinstance(toplevel, gedit.Window):
|
||||
if isinstance(toplevel, pluma.Window):
|
||||
documents_location = [doc.get_location()
|
||||
for doc in toplevel.get_documents()
|
||||
if doc.get_location() is not None]
|
||||
|
||||
documents_path = [location.get_path()
|
||||
for location in documents_location
|
||||
if gedit.utils.uri_has_file_scheme(location.get_uri())]
|
||||
if pluma.utils.uri_has_file_scheme(location.get_uri())]
|
||||
else:
|
||||
documents_path = []
|
||||
|
||||
@@ -461,25 +461,25 @@ class Document:
|
||||
def update_environment(self):
|
||||
buf = self.view.get_buffer()
|
||||
|
||||
variables = {'GEDIT_SELECTED_TEXT': self.env_get_selected_text,
|
||||
'GEDIT_CURRENT_WORD': self.env_get_current_word,
|
||||
'GEDIT_CURRENT_LINE': self.env_get_current_line,
|
||||
'GEDIT_CURRENT_LINE_NUMBER': self.env_get_current_line_number,
|
||||
'GEDIT_CURRENT_DOCUMENT_URI': self.env_get_document_uri,
|
||||
'GEDIT_CURRENT_DOCUMENT_NAME': self.env_get_document_name,
|
||||
'GEDIT_CURRENT_DOCUMENT_SCHEME': self.env_get_document_scheme,
|
||||
'GEDIT_CURRENT_DOCUMENT_PATH': self.env_get_document_path,
|
||||
'GEDIT_CURRENT_DOCUMENT_DIR': self.env_get_document_dir,
|
||||
'GEDIT_CURRENT_DOCUMENT_TYPE': self.env_get_document_type,
|
||||
'GEDIT_DOCUMENTS_URI': self.env_get_documents_uri,
|
||||
'GEDIT_DOCUMENTS_PATH': self.env_get_documents_path,
|
||||
variables = {'PLUMA_SELECTED_TEXT': self.env_get_selected_text,
|
||||
'PLUMA_CURRENT_WORD': self.env_get_current_word,
|
||||
'PLUMA_CURRENT_LINE': self.env_get_current_line,
|
||||
'PLUMA_CURRENT_LINE_NUMBER': self.env_get_current_line_number,
|
||||
'PLUMA_CURRENT_DOCUMENT_URI': self.env_get_document_uri,
|
||||
'PLUMA_CURRENT_DOCUMENT_NAME': self.env_get_document_name,
|
||||
'PLUMA_CURRENT_DOCUMENT_SCHEME': self.env_get_document_scheme,
|
||||
'PLUMA_CURRENT_DOCUMENT_PATH': self.env_get_document_path,
|
||||
'PLUMA_CURRENT_DOCUMENT_DIR': self.env_get_document_dir,
|
||||
'PLUMA_CURRENT_DOCUMENT_TYPE': self.env_get_document_type,
|
||||
'PLUMA_DOCUMENTS_URI': self.env_get_documents_uri,
|
||||
'PLUMA_DOCUMENTS_PATH': self.env_get_documents_path,
|
||||
}
|
||||
|
||||
for var in variables:
|
||||
os.environ[var] = variables[var](buf)
|
||||
|
||||
def uses_current_word(self, snippet):
|
||||
matches = re.findall('(\\\\*)\\$GEDIT_CURRENT_WORD', snippet['text'])
|
||||
matches = re.findall('(\\\\*)\\$PLUMA_CURRENT_WORD', snippet['text'])
|
||||
|
||||
for match in matches:
|
||||
if len(match) % 2 == 0:
|
||||
@@ -488,7 +488,7 @@ class Document:
|
||||
return False
|
||||
|
||||
def uses_current_line(self, snippet):
|
||||
matches = re.findall('(\\\\*)\\$GEDIT_CURRENT_LINE', snippet['text'])
|
||||
matches = re.findall('(\\\\*)\\$PLUMA_CURRENT_LINE', snippet['text'])
|
||||
|
||||
for match in matches:
|
||||
if len(match) % 2 == 0:
|
||||
@@ -865,19 +865,19 @@ class Document:
|
||||
dirname = ''
|
||||
ruri = ''
|
||||
|
||||
if gedit.utils.uri_has_file_scheme(uri):
|
||||
if pluma.utils.uri_has_file_scheme(uri):
|
||||
pathname = gfile.get_path()
|
||||
dirname = gfile.get_parent().get_path()
|
||||
|
||||
name = os.path.basename(uri)
|
||||
scheme = gfile.get_uri_scheme()
|
||||
|
||||
os.environ['GEDIT_DROP_DOCUMENT_URI'] = uri
|
||||
os.environ['GEDIT_DROP_DOCUMENT_NAME'] = name
|
||||
os.environ['GEDIT_DROP_DOCUMENT_SCHEME'] = scheme
|
||||
os.environ['GEDIT_DROP_DOCUMENT_PATH'] = pathname
|
||||
os.environ['GEDIT_DROP_DOCUMENT_DIR'] = dirname
|
||||
os.environ['GEDIT_DROP_DOCUMENT_TYPE'] = mime
|
||||
os.environ['PLUMA_DROP_DOCUMENT_URI'] = uri
|
||||
os.environ['PLUMA_DROP_DOCUMENT_NAME'] = name
|
||||
os.environ['PLUMA_DROP_DOCUMENT_SCHEME'] = scheme
|
||||
os.environ['PLUMA_DROP_DOCUMENT_PATH'] = pathname
|
||||
os.environ['PLUMA_DROP_DOCUMENT_DIR'] = dirname
|
||||
os.environ['PLUMA_DROP_DOCUMENT_TYPE'] = mime
|
||||
|
||||
buf = self.view.get_buffer()
|
||||
location = buf.get_location()
|
||||
@@ -886,7 +886,7 @@ class Document:
|
||||
|
||||
relpath = self.relative_path(ruri, uri, mime)
|
||||
|
||||
os.environ['GEDIT_DROP_DOCUMENT_RELATIVE_PATH'] = relpath
|
||||
os.environ['PLUMA_DROP_DOCUMENT_RELATIVE_PATH'] = relpath
|
||||
|
||||
mark = buf.get_mark('gtk_drag_target')
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Gedit snippets plugin
|
||||
# Pluma snippets plugin
|
||||
# Copyright (C) 2005-2006 Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@@ -62,7 +62,7 @@ def insert_with_indent(view, piter, text, indentfirst = True, context = None):
|
||||
text = spaces_instead_of_tabs(view, text)
|
||||
lines = text.split('\n')
|
||||
|
||||
view.get_buffer().set_data('GeditSnippetsPluginContext', context)
|
||||
view.get_buffer().set_data('PlumaSnippetsPluginContext', context)
|
||||
|
||||
if len(lines) == 1:
|
||||
view.get_buffer().insert(piter, text)
|
||||
@@ -79,10 +79,10 @@ def insert_with_indent(view, piter, text, indentfirst = True, context = None):
|
||||
|
||||
view.get_buffer().insert(piter, text[:-1])
|
||||
|
||||
view.get_buffer().set_data('GeditSnippetsPluginContext', None)
|
||||
view.get_buffer().set_data('PlumaSnippetsPluginContext', None)
|
||||
|
||||
def get_buffer_context(buf):
|
||||
return buf.get_data('GeditSnippetsPluginContext')
|
||||
return buf.get_data('PlumaSnippetsPluginContext')
|
||||
|
||||
def snippets_debug(*s):
|
||||
return
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Gedit snippets plugin
|
||||
# Pluma snippets plugin
|
||||
# Copyright (C) 2005-2006 Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
@@ -1,5 +1,5 @@
|
||||
# Python snippets plugin
|
||||
plugindir = $(GEDIT_PLUGINS_LIBS_DIR)/snippets
|
||||
plugindir = $(PLUMA_PLUGINS_LIBS_DIR)/snippets
|
||||
|
||||
plugin_PYTHON = \
|
||||
__init__.py \
|
||||
@@ -17,7 +17,7 @@ plugin_PYTHON = \
|
||||
LanguageManager.py \
|
||||
Completion.py
|
||||
|
||||
uidir = $(GEDIT_PLUGINS_DATA_DIR)/snippets/ui
|
||||
uidir = $(PLUMA_PLUGINS_DATA_DIR)/snippets/ui
|
||||
ui_DATA = snippets.ui
|
||||
|
||||
EXTRA_DIST = $(ui_DATA)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Gedit snippets plugin
|
||||
# Pluma snippets plugin
|
||||
# Copyright (C) 2005-2006 Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@@ -24,7 +24,7 @@ import gtk
|
||||
from gtk import gdk
|
||||
import gtksourceview2 as gsv
|
||||
import pango
|
||||
import gedit
|
||||
import pluma
|
||||
import gio
|
||||
|
||||
from Snippet import Snippet
|
||||
@@ -95,7 +95,7 @@ class Manager:
|
||||
self.tree_view.expand_row(path, False)
|
||||
|
||||
def build_model(self, force_reload = False):
|
||||
window = gedit.app_get_default().get_active_window()
|
||||
window = pluma.app_get_default().get_active_window()
|
||||
|
||||
if window:
|
||||
view = window.get_active_view()
|
||||
@@ -116,7 +116,7 @@ class Manager:
|
||||
self.model = gtk.TreeStore(str, str, object)
|
||||
self.model.set_sort_column_id(self.SORT_COLUMN, gtk.SORT_ASCENDING)
|
||||
manager = get_language_manager()
|
||||
langs = gedit.language_manager_list_languages_sorted(manager, True)
|
||||
langs = pluma.language_manager_list_languages_sorted(manager, True)
|
||||
|
||||
piter = self.model.append(None, (_('Global'), '', None))
|
||||
# Add dummy node
|
||||
@@ -618,7 +618,7 @@ class Manager:
|
||||
|
||||
def on_dialog_snippets_response(self, dlg, resp):
|
||||
if resp == gtk.RESPONSE_HELP:
|
||||
gedit.help_display(self.dlg, 'gedit', 'gedit-snippets-plugin')
|
||||
pluma.help_display(self.dlg, 'pluma', 'pluma-snippets-plugin')
|
||||
return
|
||||
|
||||
self.dlg.destroy()
|
||||
@@ -765,7 +765,7 @@ class Manager:
|
||||
success = True
|
||||
|
||||
for filename in filenames:
|
||||
if not gedit.utils.uri_has_file_scheme(filename):
|
||||
if not pluma.utils.uri_has_file_scheme(filename):
|
||||
continue
|
||||
|
||||
# Remove file://
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Gedit snippets plugin
|
||||
# Pluma snippets plugin
|
||||
# Copyright (C) 2006-2007 Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Gedit snippets plugin
|
||||
# Pluma snippets plugin
|
||||
# Copyright (C) 2005-2006 Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@@ -524,7 +524,7 @@ class PlaceholderEval(PlaceholderExpand):
|
||||
|
||||
# SIGALRM is not supported on all platforms (e.g. windows). Timeout
|
||||
# with SIGALRM will not be used on those platforms. This will
|
||||
# potentially block gedit if you have a placeholder which gets stuck,
|
||||
# potentially block pluma if you have a placeholder which gets stuck,
|
||||
# but it's better than not supporting them at all. At some point we
|
||||
# might have proper thread support and we can fix this in a better way
|
||||
def timeout_supported(self):
|
||||
@@ -577,9 +577,9 @@ class PlaceholderEval(PlaceholderExpand):
|
||||
if 'process_snippet' in self.namespace:
|
||||
try:
|
||||
# Install a sigalarm signal. This is a HACK to make sure
|
||||
# gedit doesn't get freezed by someone creating a python
|
||||
# pluma doesn't get freezed by someone creating a python
|
||||
# placeholder which for instance loops indefinately. Since
|
||||
# the code is executed synchronously it will hang gedit. With
|
||||
# the code is executed synchronously it will hang pluma. With
|
||||
# the alarm signal we raise an exception and catch this
|
||||
# (see below). We show an error message and return False.
|
||||
# ___this is a HACK___ and should be fixed properly (I just
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Gedit snippets plugin
|
||||
# Pluma snippets plugin
|
||||
# Copyright (C) 2005-2006 Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Gedit snippets plugin
|
||||
# Pluma snippets plugin
|
||||
# Copyright (C) 2006-2007 Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Gedit snippets plugin
|
||||
# Pluma snippets plugin
|
||||
# Copyright (C) 2005-2006 Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@@ -21,7 +21,7 @@ import gettext
|
||||
|
||||
import gtk
|
||||
from gtk import gdk
|
||||
import gedit
|
||||
import pluma
|
||||
|
||||
from Document import Document
|
||||
from Library import Library
|
||||
@@ -46,7 +46,7 @@ class WindowHelper:
|
||||
|
||||
# Add controllers to all the current views
|
||||
for view in self.window.get_views():
|
||||
if isinstance(view, gedit.View) and not self.has_controller(view):
|
||||
if isinstance(view, pluma.View) and not self.has_controller(view):
|
||||
view._snippet_controller = Document(self, view)
|
||||
|
||||
self.update()
|
||||
@@ -61,7 +61,7 @@ class WindowHelper:
|
||||
|
||||
# Iterate over all the tabs and remove every controller
|
||||
for view in self.window.get_views():
|
||||
if isinstance(view, gedit.View) and self.has_controller(view):
|
||||
if isinstance(view, pluma.View) and self.has_controller(view):
|
||||
view._snippet_controller.stop()
|
||||
view._snippet_controller = None
|
||||
|
||||
@@ -72,8 +72,8 @@ class WindowHelper:
|
||||
bus = self.window.get_message_bus()
|
||||
|
||||
self.messages = {
|
||||
'activate': bus.register('/plugins/snippets', 'activate', ('view', 'iter'), trigger=str, view=gedit.View, iter=gtk.TextIter),
|
||||
'parse-and-activate': bus.register('/plugins/snippets', 'parse-and-activate', ('view', 'iter'), snippet=str, view=gedit.View, iter=gtk.TextIter)
|
||||
'activate': bus.register('/plugins/snippets', 'activate', ('view', 'iter'), trigger=str, view=pluma.View, iter=gtk.TextIter),
|
||||
'parse-and-activate': bus.register('/plugins/snippets', 'parse-and-activate', ('view', 'iter'), snippet=str, view=pluma.View, iter=gtk.TextIter)
|
||||
}
|
||||
|
||||
bus.connect('/plugins/snippets', 'activate', self.on_message_activate)
|
||||
@@ -124,8 +124,8 @@ class WindowHelper:
|
||||
def insert_menu(self):
|
||||
manager = self.window.get_ui_manager()
|
||||
|
||||
self.action_group = gtk.ActionGroup("GeditSnippetPluginActions")
|
||||
self.action_group.set_translation_domain('gedit')
|
||||
self.action_group = gtk.ActionGroup("PlumaSnippetPluginActions")
|
||||
self.action_group.set_translation_domain('pluma')
|
||||
self.action_group.add_actions([('ManageSnippets', None,
|
||||
_('Manage _Snippets...'), \
|
||||
None, _('Manage snippets'), \
|
||||
@@ -192,10 +192,10 @@ class WindowHelper:
|
||||
# Callbacks
|
||||
|
||||
def on_tab_added(self, window, tab):
|
||||
# Create a new controller for this tab if it has a standard gedit view
|
||||
# Create a new controller for this tab if it has a standard pluma view
|
||||
view = tab.get_view()
|
||||
|
||||
if isinstance(view, gedit.View) and not self.has_controller(view):
|
||||
if isinstance(view, pluma.View) and not self.has_controller(view):
|
||||
view._snippet_controller = Document(self, view)
|
||||
|
||||
self.update()
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Gedit snippets plugin
|
||||
# Pluma snippets plugin
|
||||
# Copyright (C) 2005-2006 Jesse van den Kieboom <jesse@icecrew.nl>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@@ -21,7 +21,7 @@ import shutil
|
||||
|
||||
import gtk
|
||||
from gtk import gdk
|
||||
import gedit
|
||||
import pluma
|
||||
import platform
|
||||
|
||||
from WindowHelper import WindowHelper
|
||||
@@ -29,9 +29,9 @@ from Library import Library
|
||||
from Manager import Manager
|
||||
from Snippet import Snippet
|
||||
|
||||
class SnippetsPlugin(gedit.Plugin):
|
||||
class SnippetsPlugin(pluma.Plugin):
|
||||
def __init__(self):
|
||||
gedit.Plugin.__init__(self)
|
||||
pluma.Plugin.__init__(self)
|
||||
|
||||
self.dlg = None
|
||||
|
||||
@@ -39,13 +39,13 @@ class SnippetsPlugin(gedit.Plugin):
|
||||
library.set_accelerator_callback(self.accelerator_activated)
|
||||
|
||||
if platform.platform() == 'Windows':
|
||||
snippetsdir = os.path.expanduser('~/gedit/snippets')
|
||||
snippetsdir = os.path.expanduser('~/pluma/snippets')
|
||||
else:
|
||||
userdir = os.getenv('MATE22_USER_DIR')
|
||||
if userdir:
|
||||
snippetsdir = os.path.join(userdir, 'gedit/snippets')
|
||||
snippetsdir = os.path.join(userdir, 'pluma/snippets')
|
||||
else:
|
||||
snippetsdir = os.path.expanduser('~/.mate2/gedit/snippets')
|
||||
snippetsdir = os.path.expanduser('~/.mate2/pluma/snippets')
|
||||
|
||||
library.set_dirs(snippetsdir, self.system_dirs())
|
||||
|
||||
@@ -59,7 +59,7 @@ class SnippetsPlugin(gedit.Plugin):
|
||||
dirs = []
|
||||
|
||||
for d in datadirs.split(os.pathsep):
|
||||
d = os.path.join(d, 'gedit-2', 'plugins', 'snippets')
|
||||
d = os.path.join(d, 'pluma-2', 'plugins', 'snippets')
|
||||
|
||||
if os.path.isdir(d):
|
||||
dirs.append(d)
|
||||
@@ -85,7 +85,7 @@ class SnippetsPlugin(gedit.Plugin):
|
||||
else:
|
||||
self.dlg.run()
|
||||
|
||||
window = gedit.app_get_default().get_active_window()
|
||||
window = pluma.app_get_default().get_active_window()
|
||||
|
||||
if window:
|
||||
self.dlg.dlg.set_transient_for(window)
|
||||
|
@@ -32,7 +32,7 @@
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GeditDocument" id="source_buffer">
|
||||
<object class="PlumaDocument" id="source_buffer">
|
||||
<property name="highlight-matching-brackets">True</property>
|
||||
</object>
|
||||
<object class="GtkDialog" id="dialog_snippets">
|
||||
@@ -331,7 +331,7 @@
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
<child>
|
||||
<object class="GeditView" id="source_view_snippet">
|
||||
<object class="PlumaView" id="source_view_snippet">
|
||||
<property name="buffer">source_buffer</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="auto-indent">True</property>
|
||||
|
Reference in New Issue
Block a user