pygtkspellcheck-3.0/0000775000175000017500000000000012013730753016205 5ustar cjenkinscjenkins00000000000000pygtkspellcheck-3.0/README.md0000664000175000017500000000323612013730013017455 0ustar cjenkinscjenkins00000000000000# About PyGtkSpellCheck is a spellchecking library written in pure Python for Gtk based on [Enchant](http://www.abisource.com/projects/enchant/). It supports both Gtk's Python bindings, [PyGObject](https://live.gnome.org/PyGObject/) and [PyGtk](http://www.pygtk.org/), and for both Python 2 and 3 with automatic switching and binding autodetection. For automatic translation of the user interface it can use GEdit's translation files. # Features * Localized names of the available languages. * Supports word, line and multiline ignore regexes. * Support for ignore custom tags on Gtk's TextBuffer. * Enable and disable of spellchecking with preferences memory. * Support for hotswap of Gtk's TextBuffers. * PyGObject and PyGtk compatible with automatic detection. * Python 2 and 3 support. * As Enchant, support for Hunspell (LibreOffice) and Aspell (GNU) dictionaries. # Documentation You can find the documentation at http://pygtkspellcheck.readthedocs.org/ . # Homepage You can find the project page at http://koehlma.github.com/projects/pygtkspellcheck.html . # License 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 3 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, see . pygtkspellcheck-3.0/PKG-INFO0000664000175000017500000000226712013730753017311 0ustar cjenkinscjenkins00000000000000Metadata-Version: 1.1 Name: pygtkspellcheck Version: 3.0 Summary: A simple but quite powerful Python spell checking library for GtkTextViews based on Enchant. Home-page: http://koehlma.github.com/projects/pygtkspellcheck.html Author: Maximilian Köhl & Carlos Jenkins Author-email: linuxmaxi@googlemail.com & carlos@jenkins.co.cr License: GPLv3+ Download-URL: https://github.com/koehlma/pygtkspellcheck/tarball/master Description: It supports both Gtk's Python bindings, PyGObject andPyGtk, and for both Python 2 and 3 with automatic switchingand binding autodetection. For automatic translation of theuser interface it can use GEdit's translation files. Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: X11 Applications :: Gnome Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) Classifier: Operating System :: MacOS :: MacOS X Classifier: Operating System :: Microsoft :: Windows Classifier: Operating System :: POSIX Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Software Development :: Localization pygtkspellcheck-3.0/src/0000775000175000017500000000000012013730753016774 5ustar cjenkinscjenkins00000000000000pygtkspellcheck-3.0/src/gtkspellcheck/0000775000175000017500000000000012013730753021617 5ustar cjenkinscjenkins00000000000000pygtkspellcheck-3.0/src/gtkspellcheck/oxt_import.py0000664000175000017500000002075212004224443024375 0ustar cjenkinscjenkins00000000000000# -*- coding:utf-8 -*- # # Copyright (C) 2012, Carlos Jenkins # # 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 3 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, see . """ Uncompress, read and install LibreOffice .oxt dictionaries extensions. This module extracts the .dic and .aff (Hunspell) dictionaries from all the .oxt extensions found on some directory. Extensions like the ones found here: http://extensions.services.openoffice.org/dictionary """ import os import xml.dom.minidom import shutil import logging import gettext from zipfile import ZipFile, BadZipfile # Expose __all__ = ['deflate_oxt'] logger = logging.getLogger(__name__) _ = gettext.translation('pygtkspellcheck', fallback=True).gettext def deflate_oxt(oxt_path, extract_path, override=False, move_path=None): """ Uncompress, read and install LibreOffice ``.oxt`` dictionaries extensions. :param oxt_path: path to a directory containing the ``.oxt`` extensions. :param extract_path: path to extract Hunspell dictionaries files. :param override: override files. :param move_path: Optional path to move the ``.oxt`` files after processing. :rtype: None This function extracts the Hunspell dictionaries (``.dic`` and ``.aff`` files) from all the ``.oxt`` extensions found on ``oxt_path`` directory to the ``extract_path`` directory. Extensions like the ones found here: http://extensions.services.openoffice.org/dictionary In detail, this functions does the following: 1. Find all the ``.oxt`` extension files within ``oxt_path`` 2. Open (unzip) each extension. 3. Find the dictionary definition file within (*dictionaries.xcu*) 4. Parse the dictionary definition file and locate the dictionaries files. 5. Uncompress those files to ``extract_path``. By default file overriding is disabled, set ``override`` parameter to True if you want to enable it. As and additional option, each processed extension can be moved to ``move_path``. """ # Get the real, absolute and normalized path oxt_path = os.path.normpath(os.path.abspath(os.path.realpath(oxt_path))) # Check that the input directory exists if not os.path.isdir(oxt_path): return # Create extract directory if not exists if not os.path.exists(extract_path): os.makedirs(extract_path) # Check that the extract path is a directory if not os.path.isdir(extract_path): logger.error(_('Extract path is not a directory.')) return # Get all .oxt extension at given path oxt_files = [extension for extension in os.listdir(oxt_path) if extension.lower().endswith('.oxt')] for extension_name in oxt_files: extension_path = os.path.join(oxt_path, extension_name) try: with ZipFile(extension_path, 'r') as extension_file: # List of files within the extension file files_within = extension_file.namelist() # Find the dictionaries registry registry = 'dictionaries.xcu' if not registry in files_within: for file_path in files_within: if file_path.lower().endswith(registry): registry = file_path if registry in files_within: try: # Find within the registry the entry for dictionaries registry_content = extension_file.read(registry) dom = xml.dom.minidom.parseString(registry_content) dic_locations = _find_dictionaries_location(dom) if dic_locations: for dic_location in dic_locations: # Get the list of files considered dictionaries for current entry dic_location = dic_location.replace('%origin%', os.path.dirname(registry)) dic_files = [] for dic_file in dic_location.split(' '): if dic_file.startswith('/'): dic_file = dic_file[1:] dic_files.append(os.path.normpath(dic_file)) # Extract files if they exists within the extension file for dic_file in dic_files: if dic_file in files_within: target = os.path.join(extract_path, os.path.basename(dic_file)) # Extract only if we are overriding or file doesn't exists if (override and os.path.isfile(target)) or (not os.path.exists(target)): # Extract a single file without caring about folder structure with extension_file.open(dic_file) as source: with file(target, 'wb') as destination: shutil.copyfileobj(source, destination) else: logger.warning(_('\'{0}\' declared in registry but not found within the extension.').format(dic_file)) except Exception as inst: logger.exception(_('Error while processing extension {0}.').format(extension_name)) pass else: logger.error(_('Extension \'{0}\' has no dictionary registry.').format(extension_name)) except BadZipfile: logger.error(_('Extension \'{0}\' is not a valid zip file.').format(extension_name)) # Move the extension after processing if user requires it if move_path is not None: # Create move path if it doesn't exists if not os.path.exists(move_path): os.makedirs(move_path) # Move to the given path only if it is a directory and target doesn't exists if os.path.isdir(move_path): if not os.path.exists(os.path.join(move_path, extension_name)) or override: #print('Move from ', extension_path, ' to ', move_path) shutil.move(extension_path, move_path) else: logger.warning(_('Unable to move extension, file with same name exists within move_path.')) else: logger.warning(_('Unable to move extension, move_path is not a directory.')) def _find_dictionaries_location(dom): """Find the location of the dictionaries files in the extension XML registry""" def _is_text_node(element): return element.firstChild.nodeType == xml.dom.Node.TEXT_NODE result = [] root = dom.getElementsByTagName('oor:component-data')[0] for value in root.getElementsByTagName('value'): if _is_text_node(value) and value.firstChild.data == 'DICT_SPELL': dict_node = value.parentNode.parentNode for prop in dict_node.getElementsByTagName('prop'): if prop.hasAttribute('oor:name') and prop.getAttribute('oor:name') == 'Locations': dict_value = prop.getElementsByTagName('value')[0] # %origin%/es_CR.aff %origin%/es_CR.dic if _is_text_node(dict_value): result.append(dict_value.firstChild.data) # %origin%/es_CR.aff%origin%/es_CR.dic else: for item in dict_value.getElementsByTagName('it'): result.append(item.firstChild.data) break return result pygtkspellcheck-3.0/src/gtkspellcheck/spellcheck.py0000664000175000017500000005326412006755550024324 0ustar cjenkinscjenkins00000000000000# -*- coding:utf-8 -*- # # Copyright (C) 2012, Maximilian Köhl # Copyright (C) 2012, Carlos Jenkins # # 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 3 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, see . """ A spellchecking library written in pure Python for Gtk based on Enchant. It supports both Gtk's Python bindings, PyGObject and PyGtk, and for both Python 2 and 3 with automatic switching and binding autodetection. For automatic translation of the user interface it can use GEdit's translation files. """ import enchant import gettext import logging import re import sys from pylocales import code_to_name # Public Objects __all__ = ['SpellChecker'] # Logger logger = logging.getLogger(__name__) # Find which Gtk binding to use based on client's binding if 'gi.repository.Gtk' in sys.modules: gtk = sys.modules['gi.repository.Gtk'] _pygobject = True elif 'gtk' in sys.modules: gtk = sys.modules['gtk'] _pygobject = False else: logger.error('No Gtk module found. Spellcheck will be unusable.') # Select base list class for Python3/2 try: from collections import UserList _list = UserList except ImportError: _list = list # Select basestring for Python2/3 if sys.version_info.major == 3: basestring = str # Map between Gedit's translation and PyGtkSpellcheck's own _GEDIT_MAP = {'Languages' : 'Languages', 'Ignore All' : 'Ignore _All', 'Suggestions' : 'Suggestions', '(no suggestions)' : '(no suggested words)', 'Add "{word}" to Dictionary' : 'Add w_ord'} # Translation if gettext.find('gedit'): _gedit = gettext.translation('gedit', fallback=True).gettext _ = lambda message: _gedit(_GEDIT_MAP[message]).replace('_', '') else: _ = gettext.translation('pygtkspellcheck', fallback=True).gettext class SpellChecker(object): """ Main spellchecking class, everything important happens here. :param view: GtkTextView the SpellChecker should be attached to. :param language: the language which should be used for spellchecking. Use a combination of two letter lower-case ISO 639 language code with a two letter upper-case ISO 3166 country code, for example en_US or de_DE. :param prefix: a prefix for some internal GtkTextMarks. :param collapse: enclose suggestions in its own menu. :param params: dictionary with Enchant broker parameters that should be set e.g. `enchant.myspell.dictionary.path`. .. attribute:: languages A list of supported languages. .. function:: exists(language) checks if a language exists :param language: language to check """ FILTER_WORD = 'word' FILTER_LINE = 'line' FILTER_TEXT = 'text' DEFAULT_FILTERS = {FILTER_WORD : [r'[0-9.,]+'], FILTER_LINE : [r'(https?|ftp|file):((//)|(\\\\))+[\w\d:#@%/;$()~_?+-=\\.&]+', r'[\w\d]+@[\w\d.]+'], FILTER_TEXT : []} class _LanguageList(_list): def __init__(self, *args, **kwargs): if sys.version_info.major == 3: super().__init__(*args, **kwargs) else: _list.__init__(self, *args, **kwargs) self.mapping = dict(self) @classmethod def from_broker(cls, broker): return cls(sorted([(language, code_to_name(language)) for language in broker.list_languages()], key=lambda language: language[1])) def exists(self, language): return language in self.mapping class _Mark(): def __init__(self, buffer, name, start): self._buffer = buffer self._name = name self._mark = self._buffer.create_mark(self._name, start, True) @property def iter(self): return self._buffer.get_iter_at_mark(self._mark) @property def inside_word(self): return self.iter.inside_word() @property def word(self): start = self.iter if not start.starts_word(): start.backward_word_start() end = self.iter if end.inside_word(): end.forward_word_end() return start, end def move(self, location): self._buffer.move_mark(self._mark, location) def __init__(self, view, language='en', prefix='gtkspellchecker', collapse=True, params={}): self._view = view self.collapse = collapse self._view.connect('populate-popup', lambda entry, menu: self._extend_menu(menu)) self._view.connect('popup-menu', self._click_move_popup) self._view.connect('button-press-event', self._click_move_button) self._prefix = prefix if _pygobject: self._misspelled = gtk.TextTag.new('{prefix}-misspelled'.format(prefix=self._prefix)) else: self._misspelled = gtk.TextTag('{prefix}-misspelled'.format(prefix=self._prefix)) self._misspelled.set_property('underline', 4) self._broker = enchant.Broker() for param, value in params: self._broker.set_param(param, value) self.languages = SpellChecker._LanguageList.from_broker(self._broker) self._language = language if self.languages.exists(language) else 'en' self._dictionary = self._broker.request_dict(language) self._deferred_check = False self._filters = dict(SpellChecker.DEFAULT_FILTERS) self._regexes = {SpellChecker.FILTER_WORD : re.compile('|'.join(self._filters[SpellChecker.FILTER_WORD])), SpellChecker.FILTER_LINE : re.compile('|'.join(self._filters[SpellChecker.FILTER_LINE])), SpellChecker.FILTER_TEXT : re.compile('|'.join(self._filters[SpellChecker.FILTER_TEXT]), re.MULTILINE)} self._enabled = True self.buffer_initialize() @property def language(self): """ The language used for spellchecking """ return self._language @language.setter def language(self, language): if language != self._language and self.languages.exists(language): self._language = language self._dictionary = self._broker.request_dict(language) self.recheck() @property def enabled(self): """ Enable or disable spellchecking """ return self._enabled @enabled.setter def enabled(self, enabled): if enabled and not self._enabled: self.enable() elif not enabled and self._enabled: self.disable() def buffer_initialize(self): """ Initialize the GtkTextBuffer associated with the GtkTextView. If you associate a new GtkTextBuffer with the GtkTextView call this method. """ self._buffer = self._view.get_buffer() self._buffer.connect('insert-text', self._before_text_insert) self._buffer.connect_after('insert-text', self._after_text_insert) self._buffer.connect_after('delete-range', self._range_delete) self._buffer.connect_after('mark-set', self._mark_set) start = self._buffer.get_bounds()[0] self._marks = {'insert-start' : SpellChecker._Mark(self._buffer, '{prefix}-insert-start'.format(prefix=self._prefix), start), 'insert-end' : SpellChecker._Mark(self._buffer, '{prefix}-insert-end'.format(prefix=self._prefix), start), 'click' : SpellChecker._Mark(self._buffer, '{prefix}-click'.format(prefix=self._prefix), start)} self._table = self._buffer.get_tag_table() self._table.add(self._misspelled) self.ignored_tags = [] def tag_added(tag, *args): if hasattr(tag, 'spell_check') and not getattr(tag, 'spell_check'): self.ignored_tags.append(tag) def tag_removed(tag, *args): if tag in self.ignored_tags: self.ignored_tags.remove(tag) self._table.connect('tag-added', tag_added) self._table.connect('tag-removed', tag_removed) self._table.foreach(tag_added, None) self.no_spell_check = self._table.lookup('no-spell-check') if not self.no_spell_check: if _pygobject: self.no_spell_check = gtk.TextTag.new('no-spell-check') else: self.no_spell_check = gtk.TextTag('no-spell-check') self._table.add(self.no_spell_check) self.recheck() def recheck(self): """ Rechecks the spelling of the whole text. """ start, end = self._buffer.get_bounds() self.check_range(start, end, True) def disable(self): """ Disable spellchecking. """ self._enabled = False start, end = self._buffer.get_bounds() self._buffer.remove_tag(self._misspelled, start, end) def enable(self): """ Enable spellchecking. """ self._enabled = True self.recheck() def append_filter(self, regex, filter_type): """ Append a new filter to the filter list. Filters are useful to ignore some misspelled words based on regular expressions. :param regex: the regex used for filtering :param filter_type: the type of the filter Filter Types: :const:`SpellChecker.FILTER_WORD`: The regex must match the whole word you want to filter. The word separation is done by Pango's word separation algorythm so, for example, urls won't work here because they are split in many words. :const:`SpellChecker.FILTER_LINE`: If the expression you want to match is a single line expression use this type. It should not be an open end expression because then the rest of the line with the text you want to filter will become correct. :const:`SpellChecker.FILTER_TEXT`: Use this if you want to filter multiline expressions. The regex will be compiled with the `MULTILINE` flag. Same with open end expressions apply here. """ self._filters[filter_type].append(regex) if filter_type == SpellChecker.FILTER_TEXT: self._regexes[filter_type] = re.compile('|'.join(self._filters[filter_type]), re.MULTILINE) else: self._regexes[filter_type] = re.compile('|'.join(self._filters[filter_type])) def remove_filter(self, regex, filter_type): """ Remove a filter from the filter list. :param regex: the regex which used for filtering :param filter_type: the type of the filter """ self._filters[filter_type].remove(regex) if filter_type == SpellChecker.FILTER_TEXT: self._regexes[filter_type] = re.compile('|'.join(self._filters[filter_type]), re.MULTILINE) else: self._regexes[filter_type] = re.compile('|'.join(self._filters[filter_type])) def append_ignore_tag(self, tag): """ Appends a tag to the list of ignored tags. A string will be automatic resolved into a tag object. :param tag: tag object or tag name """ if isinstance(tag, basestring): tag = self._table.lookup(tag) self.ignored_tags.append(tag) def remove_ignore_tag(self, tag): """ Removes a tag from the list of ignored tags. A string will be automatic resolved into a tag object. :param tag: tag object or tag name """ if isinstance(tag, basestring): tag = self._table.lookup(tag) self.ignored_tags.remove(tag) def add_to_dictionary(self, word): """ Adds a word to user's dictionary. :param word: the word to add """ self._dictionary.add_to_pwl(word) self.recheck() def ignore_all(self, word): """ Ignores a word for the current session. :param word: the word to ignore """ self._dictionary.add_to_session(word) self.recheck() def check_range(self, start, end, force_all=False): """ Checks a specified range between two GtkTextIters. :param start: start iter - checking starts here :param end: end iter - checking ends here """ if not self._enabled: return if end.inside_word(): end.forward_word_end() if not start.starts_word() and (start.inside_word() or start.ends_word()): start.backward_word_start() self._buffer.remove_tag(self._misspelled, start, end) cursor = self._buffer.get_iter_at_mark(self._buffer.get_insert()) precursor = cursor.copy() precursor.backward_char() highlight = cursor.has_tag(self._misspelled) or precursor.has_tag(self._misspelled) if not start.get_offset(): start.forward_word_end() start.backward_word_start() word_start = start.copy() while word_start.compare(end) < 0: word_end = word_start.copy() word_end.forward_word_end() in_word = (word_start.compare(cursor) < 0) and (cursor.compare(word_end) <= 0) if in_word and not force_all: if highlight: self._check_word(word_start, word_end) else: self._deferred_check = True else: self._check_word(word_start, word_end) self._deferred_check = False word_end.forward_word_end() word_end.backward_word_start() if word_start.equal(word_end): break word_start = word_end.copy() def _languages_menu(self): def _set_language(item, code): self.language = code if _pygobject: menu = gtk.Menu.new() group = [] else: menu = gtk.Menu() group = gtk.RadioMenuItem() connect = [] for code, name in self.languages: if _pygobject: item = gtk.RadioMenuItem.new_with_label(group, name) group.append(item) else: item = gtk.RadioMenuItem(group, name) if code == self.language: item.set_active(True) connect.append((item, code)) menu.append(item) for item, code in connect: item.connect('activate', _set_language, code) return menu def _suggestion_menu(self, word): menu = [] suggestions = self._dictionary.suggest(word) if not suggestions: if _pygobject: item = gtk.MenuItem.new() label = gtk.Label.new('') else: item = gtk.MenuItem() label = gtk.Label() try: label.set_halign(gtk.Align.LEFT) except AttributeError: label.set_alignment(0.0, 0.5) label.set_markup('{text}'.format(text=_('(no suggestions)'))) item.add(label) menu.append(item) else: for suggestion in suggestions: if _pygobject: item = gtk.MenuItem.new() label = gtk.Label.new('') else: item = gtk.MenuItem() label = gtk.Label() label.set_markup('{text}'.format(text=suggestion)) try: label.set_halign(gtk.Align.LEFT) except AttributeError: label.set_alignment(0.0, 0.5) item.add(label) item.connect('activate', self._replace_word, word, suggestion) menu.append(item) if _pygobject: menu.append(gtk.SeparatorMenuItem.new()) item = gtk.MenuItem.new_with_label(_('Add "{word}" to Dictionary').format(word=word)) else: menu.append(gtk.SeparatorMenuItem()) item = gtk.MenuItem(_('Add "{word}" to Dictionary').format(word=word)) item.connect('activate', lambda *args: self.add_to_dictionary(word)) menu.append(item) if _pygobject: item = gtk.MenuItem.new_with_label(_('Ignore All')) else: item = gtk.MenuItem(_('Ignore All')) item.connect('activate', lambda *args: self.ignore_all(word)) menu.append(item) return menu def _extend_menu(self, menu): if not self._enabled: return if _pygobject: separator = gtk.SeparatorMenuItem.new() else: separator = gtk.SeparatorMenuItem() separator.show() menu.prepend(separator) if _pygobject: languages = gtk.MenuItem.new_with_label(_('Languages')) else: languages = gtk.MenuItem(_('Languages')) languages.set_submenu(self._languages_menu()) languages.show_all() menu.prepend(languages) if self._marks['click'].inside_word: start, end = self._marks['click'].word if start.has_tag(self._misspelled): word = self._buffer.get_text(start, end, False) submenu_items = self._suggestion_menu(word) if self.collapse: if _pygobject: suggestions = gtk.MenuItem.new_with_label(_('Suggestions')) submenu = gtk.Menu.new() else: suggestions = gtk.MenuItem(_('Suggestions')) submenu = gtk.Menu() for i in submenu_items: submenu.append(i) suggestions.set_submenu(submenu) suggestions.show_all() menu.prepend(suggestions) else: submenu_items.reverse() for i in submenu_items: menu.prepend(i) menu.show_all() def _click_move_popup(self, *args): self._marks['click'].move(self._buffer.get_iter_at_mark(self._buffer.get_insert())) return False def _click_move_button(self, widget, event): if event.button == 3: if self._deferred_check: self._check_deferred_range(True) x, y = self._view.window_to_buffer_coords(2, int(event.x), int(event.y)) self._marks['click'].move(self._view.get_iter_at_location(x, y)) return False def _before_text_insert(self, textbuffer, location, text, length): self._marks['insert-start'].move(location) def _after_text_insert(self, textbuffer, location, text, length): start = self._marks['insert-start'].iter self.check_range(start, location) self._marks['insert-end'].move(location) def _range_delete(self, textbuffer, start, end): self.check_range(start, end) def _mark_set(self, textbuffer, location, mark): if mark == self._buffer.get_insert() and self._deferred_check: self._check_deferred_range(False) def _replace_word(self, item, old_word, new_word): start, end = self._marks['click'].word offset = start.get_offset() self._buffer.begin_user_action() self._buffer.delete(start, end) self._buffer.insert(self._buffer.get_iter_at_offset(offset), new_word) self._buffer.end_user_action() self._dictionary.store_replacement(old_word, new_word) def _check_deferred_range(self, force_all): start = self._marks['insert-start'].iter end = self._marks['insert-end'].iter self.check_range(start, end, force_all) def _check_word(self, start, end): if start.has_tag(self.no_spell_check): return for tag in self.ignored_tags: if start.has_tag(tag): return word = self._buffer.get_text(start, end, False).strip() if len(self._filters[SpellChecker.FILTER_WORD]): if self._regexes[SpellChecker.FILTER_WORD].match(word): return if len(self._filters[SpellChecker.FILTER_LINE]): line_start = self._buffer.get_iter_at_line(start.get_line()) line_end = end.copy() line_end.forward_to_line_end() line = self._buffer.get_text(line_start, line_end, False) for match in self._regexes[SpellChecker.FILTER_LINE].finditer(line): if match.start() <= start.get_line_offset() <= match.end(): start = self._buffer.get_iter_at_line_offset(start.get_line(), match.start()) end = self._buffer.get_iter_at_line_offset(start.get_line(), match.end()) self._buffer.remove_tag(self._misspelled, start, end) return if len(self._filters[SpellChecker.FILTER_TEXT]): text_start, text_end = self._buffer.get_bounds() text = self._buffer.get_text(text_start, text_end, False) for match in self._regexes[SpellChecker.FILTER_TEXT].finditer(text): if match.start() <= start.get_offset() <= match.end(): start = self._buffer.get_iter_at_offset(match.start()) end = self._buffer.get_iter_at_offset(match.end()) self._buffer.remove_tag(self._misspelled, start, end) return if not self._dictionary.check(word): self._buffer.apply_tag(self._misspelled, start, end) pygtkspellcheck-3.0/src/gtkspellcheck/__init__.py0000664000175000017500000000473112013730013023722 0ustar cjenkinscjenkins00000000000000# -*- coding:utf-8 -*- # # Copyright (C) 2012, Maximilian Köhl # Copyright (C) 2012, Carlos Jenkins # # 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 3 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, see . # Python 2/3 unicode import sys if sys.version_info.major == 3: u = lambda x: x else: u = lambda x: x.decode('utf-8') # Metadata __version__ = '3.0' __project__ = 'Python GTK Spellcheck' __short_name__ = 'pygtkspellcheck' __authors__ = u('Maximilian Köhl & Carlos Jenkins') __emails__ = u('linuxmaxi@googlemail.com & carlos@jenkins.co.cr') __website__ = 'http://koehlma.github.com/projects/pygtkspellcheck.html' __download_url__ = 'https://github.com/koehlma/pygtkspellcheck/tarball/master' __source__ = 'https://github.com/koehlma/pygtkspellcheck/' __vcs__ = 'git://github.com/koehlma/pygtkspellcheck.git' __copyright__ = u('2012, Maximilian Köhl & Carlos Jenkins') __desc_short__ = 'A simple but quite powerful Python spell checking library for GtkTextViews based on Enchant.' __desc_long__ = ('It supports both Gtk\'s Python bindings, PyGObject and' 'PyGtk, and for both Python 2 and 3 with automatic switching' 'and binding autodetection. For automatic translation of the' 'user interface it can use GEdit\'s translation files.') __metadata__ = {'__version__' : __version__, '__project__' : __project__, '__short_name__' : __short_name__, '__authors__' : __authors__, '__emails__' : __emails__, '__website__' : __website__, '__download_url__' : __download_url__, '__source__' : __source__, '__vcs__' : __vcs__, '__copyright__' : __copyright__, '__desc_short__' : __desc_short__, '__desc_long__' : __desc_long__} # import SpellChecker class from gtkspellcheck.spellcheck import SpellCheckerpygtkspellcheck-3.0/src/pylocales/0000775000175000017500000000000012013730753020767 5ustar cjenkinscjenkins00000000000000pygtkspellcheck-3.0/src/pylocales/__init__.py0000664000175000017500000000442212004224443023074 0ustar cjenkinscjenkins00000000000000# -*- coding:utf-8 -*- # # Copyright (C) 2012, Maximilian Köhl # # 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 3 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, see . # Python 2/3 unicode import sys if sys.version_info.major == 3: u = lambda x: x else: u = lambda x: x.decode('utf-8') # Metadata __version__ = '1.1' __project__ = 'PyLocales' __short_name__ = 'pylocales' __authors__ = u('Maximilian Köhl & Carlos Jenkins') __emails__ = u('linuxmaxi@googlemail.com & carlos@jenkins.co.cr') __website__ = 'http://pygtkspellcheck.readthedocs.org/' __source__ = 'https://github.com/koehlma/pygtkspellcheck/' __vcs__ = 'git://github.com/koehlma/pygtkspellcheck.git' __copyright__ = u('2012, Maximilian Köhl & Carlos Jenkins') __desc_short__ = 'Query the ISO 639/3166 database about a country or a language.' __desc_long__ = ('Query the ISO 639/3166 database about a country or a' 'language. The locales database contains ISO 639 languages' 'definitions and ISO 3166 countries definitions. This package' 'provides translation for countries and languages names if' 'iso-codes package is installed (Ubuntu/Debian).') __metadata__ = {'__version__' : __version__, '__project__' : __project__, '__short_name__' : __short_name__, '__authors__' : __authors__, '__emails__' : __emails__, '__website__' : __website__, '__source__' : __source__, '__vcs__' : __vcs__, '__copyright__' : __copyright__, '__desc_short__' : __desc_short__, '__desc_long__' : __desc_long__} # Should only import Public Objects from pylocales.locales import * pygtkspellcheck-3.0/src/pylocales/locales.py0000664000175000017500000001142312004224443022756 0ustar cjenkinscjenkins00000000000000# -*- coding:utf-8 -*- # # Copyright (C) 2012, Maximilian Köhl # Copyright (C) 2012, Carlos Jenkins # # 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 3 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, see . """ Query the ISO 639/3166 database about a country or a language. The locales database contains ISO 639 languages definitions and ISO 3166 countries definitions. This package provides translation for countries and languages names if iso-codes package is installed (Ubuntu/Debian). @see utils/locales/build.py to know the database tables and structure. """ import gettext import logging import os import sqlite3 # Public Objects __all__ = ['Country', 'Language', 'LanguageNotFound', 'CountryNotFound', 'code_to_name'] # Translation _translator_language = gettext.translation('iso_639', fallback=True).gettext _translator_country = gettext.translation('iso_3166', fallback=True).gettext # Decides where the database is located. If an application provides an # os.path.get_module_path monkey patch to determine the path where the module # is located it uses this. If not it searches in the directory of this source # code file. __path__ = None if hasattr(os.path, 'get_module_path'): __path__ = os.path.get_module_path(__file__) if not os.path.isfile(os.path.join(__path__, 'locales.db')): __path__ = None if __path__ is None: __path__ = os.path.abspath(os.path.realpath(os.path.dirname(__file__))) # Loading the Database _database = sqlite3.connect(os.path.join(__path__, 'locales.db')) logger = logging.getLogger(__name__) # Exceptions class LanguageNotFound(Exception): """ The specified language wasn't found in the database. """ class CountryNotFound(Exception): """ The specified country wasn't found in the database. """ class Country(object): def __init__(self, rowid): country = _database.execute('SELECT * FROM countries WHERE rowid == ?', (rowid,)).fetchone() self.name = country[0] self.official_name = country[1] self.alpha_2 = country[2] self.alpha_3 = country[3] self.numeric = country[4] self.translation = _translator_country(self.name) @classmethod def get_country(cls, code, codec): country = _database.execute('SELECT rowid FROM countries WHERE %s == ?' % (codec), (code,)).fetchone() if country: return cls(country[0]) raise CountryNotFound('code: %s, codec: %s' % (code, codec)) @classmethod def by_alpha_2(cls, code): return Country.get_country(code, 'alpha_2') @classmethod def by_alpha_3(cls, code): return Country.get_country(code, 'alpha_3') @classmethod def by_numeric(cls, code): return Country.get_country(code, 'numeric') class Language(object): def __init__(self, rowid): language = _database.execute('SELECT * FROM languages WHERE rowid == ?', (rowid,)).fetchone() self.name = language[0] self.iso_639_2B = language[1] self.iso_639_2T = language[2] self.iso_639_1 = language[3] self.translation = _translator_language(self.name) @classmethod def get_language(cls, code, codec): language = _database.execute('SELECT rowid FROM languages WHERE %s == ?' % (codec), (code,)).fetchone() if language: return cls(language[0]) raise LanguageNotFound('code: %s, codec: %s' % (code, codec)) @classmethod def by_iso_639_2B(cls, code): return Language.get_language(code, 'iso_639_2B') @classmethod def by_iso_639_2T(cls, code): return Language.get_language(code, 'iso_639_2T') @classmethod def by_iso_639_1(cls, code): return Language.get_language(code, 'iso_639_1') def code_to_name(code, separator='_'): """ Get the natural name of a language based on it's code. """ logger.debug('requesting name for code "{}"'.format(code)) code = code.split(separator) if len(code) > 1: lang = Language.by_iso_639_1(code[0]).translation country = Country.by_alpha_2(code[1]).translation return '{lang} ({country})'.format(lang=lang, country=country) else: return Language.by_iso_639_1(code[0]).translationpygtkspellcheck-3.0/src/pylocales/locales.db0000664000175000017500000007200012004224443022711 0ustar cjenkinscjenkins00000000000000SQLite format 3@ - 77_ tablelanguageslanguagesCREATE TABLE languages (name, iso_639_2B, iso_639_2T, iso_639_1)ftablecountriescountriesCREATE TABLE countries (name, official_name, alpha_2, alpha_3, numeric) s ` L 7 v`F/ O(_? zT1jI# H~@"wL" h?_HBermudaBMBMU060$/BeninRepublic of BeninBJBEN204BelizeBZBLZ084'1BelgiumKingdom of BelgiumBEBEL056(3BelarusRepublic of BelarusBYBLR112BarbadosBBBRB0527!KBangladeshPeople's Republic of BangladeshBDBGD050'1BahrainKingdom of BahrainBHBHR0480CBahamasCommonwealth of the BahamasBSBHS044.!9AzerbaijanRepublic of AzerbaijanAZAZE031(3AustriaRepublic of AustriaATAUT040AustraliaAUAUS036 ArubaAWABW533( 3ArmeniaRepublic of ArmeniaAMARM051) 1ArgentinaArgentine RepublicARARG032! 3Antigua and BarbudaAGATG028 !AntarcticaAQATA010AnguillaAIAIA660&1AngolaRepublic of AngolaAOAGO024,;AndorraPrincipality of AndorraADAND020)American SamoaASASM016<[AlgeriaPeople's Democratic Republic of AlgeriaDZDZA012(3AlbaniaRepublic of AlbaniaALALB008)Åland IslandsAXALA2488#KAfghanistanIslamic Republic of AfghanistanAFAFG004 9:vH'^HY9/-Christmas IslandCXCXR162-.AChinaPeople's Republic of ChinaCNCHN156$-/ChileRepublic of ChileCLCHL152",-ChadRepublic of ChadTDTCD148&+=Central African RepublicCFCAF140*)Cayman IslandsKYCYM136.)!9Cape VerdeRepublic of Cape VerdeCVCPV132(CanadaCACAN124*'5CameroonRepublic of CameroonCMCMR120)&3CambodiaKingdom of CambodiaKHKHM116(%3BurundiRepublic of BurundiBIBDI108$%Burkina FasoBFBFA854*#5BulgariaRepublic of BulgariaBGBGR100"/Brunei DarussalamBNBRN096,!IBritish Indian Ocean TerritoryIOIOT0861 GBrazilFederative Republic of BrazilBRBRA076'Bouvet IslandBVBVT074*5BotswanaRepublic of BotswanaBWBWA072F9QBosnia and HerzegovinaRepublic of Bosnia and HerzegovinaBABIH070POOBonaire, Saint Eustatius and SabaBonaire, Saint Eustatius and SabaBQBES535KKIBolivia, Plurinational State ofPlurinational State of BoliviaBOBOL068%/BhutanKingdom of BhutanBTBTN064 >X#uQ1 fDh>(F3EstoniaRepublic of EstoniaEEEST233EEritreaERERI2325DjiboutiRepublic of DjiboutiDJDJI262'=1DenmarkKingdom of DenmarkDKDNK208<)Czech RepublicCZCZE203&;1CyprusRepublic of CyprusCYCYP196:CuraçaoCuraçaoCWCUW531"9-CubaRepublic of CubaCUCUB192(83CroatiaRepublic of CroatiaHRHRV19167)ACôte d'IvoireRepublic of Côte d'IvoireCICIV384.6!9Costa RicaRepublic of Costa RicaCRCRI1885%Cook IslandsCKCOK18434WCongo, The Democratic Republic of theCDCOD180(37CongoRepublic of the CongoCGCOG178)25ComorosUnion of the ComorosKMCOM174*15ColombiaRepublic of ColombiaCOCOL170%0;Cocos (Keeling) IslandsCCCCK166 AyIl@)xaG3gA$`/HaitiRepublic of HaitiHTHTI332&_1GuyanaRepublic of GuyanaGYGUY3284^'?Guinea-BissauRepublic of Guinea-BissauGWGNB624&]1GuineaRepublic of GuineaGNGIN324\GuernseyGGGGY831,[7GuatemalaRepublic of GuatemalaGTGTM320ZGuamGUGUM316Y!GuadeloupeGPGLP312XGrenadaGDGRD308WGreenlandGLGRL304%V/GreeceHellenic RepublicGRGRC300UGibraltarGIGIB292$T/GhanaRepublic of GhanaGHGHA2880SCGermanyFederal Republic of GermanyDEDEU276RGeorgiaGEGEO268*Q9GambiaRepublic of the GambiaGMGMB270$P/GabonGabonese RepublicGAGAB266)OCFrench Southern TerritoriesTFATF260N-French PolynesiaPFPYF258M'French GuianaGFGUF254#L+FranceFrench RepublicFRFRA250(K3FinlandRepublic of FinlandFIFIN246.JEFijiRepublic of the Fiji IslandsFJFJI242I'Faroe IslandsFOFRO234)HCFalkland Islands (Malvinas)FKFLK238=G[EthiopiaFederal Democratic Republic of EthiopiaETETH231 Tv-D  xb1TYvYWKorea, Democratic People's Republic ofDemocratic People's Republic of KoreaKPPRK408*u5KiribatiRepublic of KiribatiKIKIR296$t/KenyaRepublic of KenyaKEKEN404.s!9KazakhstanRepublic of KazakhstanKZKAZ398/rCJordanHashemite Kingdom of JordanJOJOR400qJerseyJEJEY832pJapanJPJPN392oJamaicaJMJAM388#n-ItalyItalian RepublicITITA380#m+IsraelState of IsraelILISR376l#Isle of ManIMIMN833kIrelandIEIRL372"j-IraqRepublic of IraqIQIRQ368?i?=Iran, Islamic Republic ofIslamic Republic of IranIRIRN364,h7IndonesiaRepublic of IndonesiaIDIDN360$g/IndiaRepublic of IndiaININD356(f3IcelandRepublic of IcelandISISL352(e3HungaryRepublic of HungaryHUHUN348GdmHong KongHong Kong Special Administrative Region of ChinaHKHKG344*c5HondurasRepublic of HondurasHNHND340+bGHoly See (Vatican City State)VAVAT336/aOHeard Island and McDonald IslandsHMHMD334 R`8n3> yR$ /MaltaRepublic of MaltaMTMLT470" -MaliRepublic of MaliMLMLI466*5MaldivesRepublic of MaldivesMVMDV462MalaysiaMYMYS458&1MalawiRepublic of MalawiMWMWI454.!9MadagascarRepublic of MadagascarMGMDG450M9_Macedonia, Republic ofThe Former Yugoslav Republic of MacedoniaMKMKD807?eMacaoMacao Special Administrative Region of ChinaMOMAC4461!?LuxembourgGrand Duchy of LuxembourgLULUX442,7LithuaniaRepublic of LithuaniaLTLTU4408'GLiechtensteinPrincipality of LiechtensteinLILIE438M9_Libyan Arab JamahiriyaSocialist People's Libyan Arab JamahiriyaLYLBY434(~3LiberiaRepublic of LiberiaLRLBR430'}1LesothoKingdom of LesothoLSLSO426&|/LebanonLebanese RepublicLBLBN422&{1LatviaRepublic of LatviaLVLVA428.zMLao People's Democratic RepublicLALAO418'y!+KyrgyzstanKyrgyz RepublicKGKGZ417#x+KuwaitState of KuwaitKWKWT414 w1Korea, Republic ofKRKOR410 >k<$rE,i>m>, 7NicaraguaRepublic of NicaraguaNINIC558#New ZealandNZNZL554'New CaledoniaNCNCL5403#ANetherlandsKingdom of the NetherlandsNLNLD5287UNepalFederal Democratic Republic of NepalNPNPL524$/NauruRepublic of NauruNRNRU520(3NamibiaRepublic of NamibiaNANAM516%-MyanmarUnion of MyanmarMMMMR104.!9MozambiqueRepublic of MozambiqueMZMOZ508'1MoroccoKingdom of MoroccoMAMAR504!MontserratMSMSR500"!!MontenegroMontenegroMEMNE499MongoliaMNMNG496*9MonacoPrincipality of MonacoMCMCO492553Moldova, Republic ofRepublic of MoldovaMDMDA498KKIMicronesia, Federated States ofFederated States of MicronesiaFMFSM583)7MexicoUnited Mexican StatesMXMEX484MayotteYTMYT175,7MauritiusRepublic of MauritiusMUMUS4806 !IMauritaniaIslamic Republic of MauritaniaMRMRT478 !MartiniqueMQMTQ474> -MMarshall IslandsRepublic of the Marshall IslandsMHMHL584 =}^ _u>%x`= 71Russian FederationRURUS6436RomaniaROROU6425ReunionREREU638!4)QatarState of QatarQAQAT6343#Puerto RicoPRPRI630)23PortugalPortuguese RepublicPTPRT620&11PolandRepublic of PolandPLPOL6160PitcairnPNPCN6124/#CPhilippinesRepublic of the PhilippinesPHPHL608".-PeruRepublic of PeruPEPER604*-5ParaguayRepublic of ParaguayPYPRY600,-Papua New GuineaPGPNG598&+1PanamaRepublic of PanamaPAPAN591K*KIPalestinian Territory, OccupiedOccupied Palestinian TerritoryPSPSE275$)/PalauRepublic of PalauPWPLW5852(EPakistanIslamic Republic of PakistanPKPAK586#'/OmanSultanate of OmanOMOMN512%&/NorwayKingdom of NorwayNONOR578R%=eNorthern Mariana IslandsCommonwealth of the Northern Mariana IslandsMPMNP580$)Norfolk IslandNFNFK574"#-NiueRepublic of NiueNUNIU5700"CNigeriaFederal Republic of NigeriaNGNGA566(!7NigerRepublic of the NigerNENER562 6yS7 PvEV6L+Solomon IslandsSBSLB090*K5SloveniaRepublic of SloveniaSISVN705%J+SlovakiaSlovak RepublicSKSVK7033I%?Sint MaartenSint Maarten (Dutch part)SXSXM702,H7SingaporeRepublic of SingaporeSGSGP7022G%=Sierra LeoneRepublic of Sierra LeoneSLSLE694.F!9SeychellesRepublic of SeychellesSCSYC690&E1SerbiaRepublic of SerbiaRSSRB688(D3SenegalRepublic of SenegalSNSEN6861C%;Saudi ArabiaKingdom of Saudi ArabiaSASAU682OB7eSao Tome and PrincipeDemocratic Republic of Sao Tome and PrincipeSTSTP678.A!9San MarinoRepublic of San MarinoSMSMR674-@ASamoaIndependent State of SamoaWSWSM882.?MSaint Vincent and the GrenadinesVCVCT670'>?Saint Pierre and MiquelonPMSPM666(=ASaint Martin (French part)MFMAF663<#Saint LuciaLCLCA662#;7Saint Kitts and NevisKNKNA659::eSaint Helena, Ascension and Tristan da CunhaSHSHN6549/Saint BarthélemyBLBLM652%8/RwandaRwandese RepublicRWRWA646 JgA~P(`pJ#`-TongaKingdom of TongaTOTON776_TokelauTKTKL772#^/TogoTogolese RepublicTGTGO768;]#QTimor-LesteDemocratic Republic of Timor-LesteTLTLS626)\3ThailandKingdom of ThailandTHTHA764E[ECTanzania, United Republic ofUnited Republic of TanzaniaTZTZA834.Z!9TajikistanRepublic of TajikistanTJTJK762@Y??Taiwan, Province of ChinaTaiwan, Province of ChinaTWTWN158"X5Syrian Arab RepublicSYSYR760,W#3SwitzerlandSwiss ConfederationCHCHE756%V/SwedenKingdom of SwedenSESWE752+U5SwazilandKingdom of SwazilandSZSWZ748$T9Svalbard and Jan MayenSJSJM744*S5SurinameRepublic of SurinameSRSUR740(R7SudanRepublic of the SudanSDSDN736AQaSri LankaDemocratic Socialist Republic of Sri LankaLKLKA144#P-SpainKingdom of SpainESESP724:OeSouth Georgia and the South Sandwich IslandsGSSGS2392N%=South AfricaRepublic of South AfricaZAZAF710$M+SomaliaSomali RepublicSOSOM706 JiL# SYJEs5SVirgin Islands, U.S.Virgin Islands of the United StatesVIVIR850;r;9Virgin Islands, BritishBritish Virgin IslandsVGVGB0924qIViet NamSocialist Republic of Viet NamVNVNM704OpOMVenezuela, Bolivarian republic ofBolivarian Republic of VenezuelaVEVEN862(o3VanuatuRepublic of VanuatuVUVUT548.n!9UzbekistanRepublic of UzbekistanUZUZB8600mCUruguayEastern Republic of UruguayUYURY8582lUUnited States Minor Outlying IslandsUMUMI5813k'=United StatesUnited States of AmericaUSUSA840Pj)uUnited KingdomUnited Kingdom of Great Britain and Northern IrelandGBGBR826"i5United Arab EmiratesAEARE784hUkraineUAUKR804&g1UgandaRepublic of UgandaUGUGA800fTuvaluTVTUV798&e=Turks and Caicos IslandsTCTCA796d%TurkmenistanTMTKM795&c1TurkeyRepublic of TurkeyTRTUR792(b3TunisiaRepublic of TunisiaTNTUN788@a3KTrinidad and TobagoRepublic of Trinidad and TobagoTTTTO780 BoB*x5ZimbabweRepublic of ZimbabweZWZWE716&w1ZambiaRepublic of ZambiaZMZMB894$v/YemenRepublic of YemenYEYEM887u)Western SaharaEHESH732t/Wallis and FutunaWFWLF876 #a\G/ {S@#s_>+ta#Awadhiawaawa"Avestanaveaveae!Avaricavaavaav 5Australian languagesausaus5Athapascan languagesathath1YAsturian; Bable; Leonese; AsturleoneseastastAssameseasmasmasArawakarwarw5Artificial languagesartartArapahoarparp3Mapudungun; MapuchearnarnArmenianarmhyehyAragoneseargarganJ Official Aramaic (700-300 BCE); Imperial Aramaic (700-300 BCE)arcarcArabicaraaraar-Apache languagesapaapaAngikaanpanp&CEnglish, Old (ca. 450-1100)angangAmharicamhamham)Southern Altaialtalt5Algonquian languagesalgalgAleutaleale Albanianalbsqisq Akkadianakkakk Akanakaakaak Ainuainain AfrikaansafrafrafAfrihiliafhafh!9Afro-Asiatic languagesafaafa)Adyghe; AdygeiadyadyAdangmeadaadaAcoliachachAchineseaceaceAbkhazianabkabkabAfaraaraaraa &nlVA,oP>(wbJ4 nICebuanocebcebH3Caucasian languagescaucauG1Catalan; ValenciancatcatcaF%Galibi Caribcarcar,EOCentral American Indian languagescaicaiDCaddocadcadC#Blin; BilinbynbynBBurmeseburmyamyABulgarianbulbulbg@Buginesebugbug?Buriatbuabua>+Batak languagesbtkbtk=Bretonbrebrebr<Brajbrabra;Bosnianbosbosbs:+Bantu languagesbntbnt9Siksikablabla8Bislamabisbisbi7Bini; Edobinbin6Bikolbikbik5-Bihari languagesbihbihbh4Bhojpuribhobho3-Berber languagesberber2Bengalibenbenbn1Bembabembem0!Belarusianbelbelbe/+Beja; Bedawiyetbejbej.-Baltic languagesbatbat-Basabasbas,Basquebaqeuseu+Balinesebanban*Bambarabambambm)Baluchibalbal(Bashkirbakbakba'1Bamileke languagesbaibai&+Banda languagesbadbad%#Azerbaijaniazeazeaz$Aymaraaymaymay ![wbQ6"t_B/s`5p[jDelawaredeldeli5Land Dayak languagesdaydayhDargwadardargDanishdandandafDakotadakdakeCzechczecescsd1Cushitic languagescuscuscKashubiancsbcsbb3Creoles and pidginscrpcrp)aICrimean Tatar; Crimean Turkishcrhcrh`Creecrecrecr0_WCreoles and pidgins, Portuguese-basedcppcpp,^OCreoles and pidgins, French-basedcpfcpf-]QCreoles and pidgins, English basedcpecpe\Corsicancoscosco[CornishcorcorkwZCopticcopcopY-Chamic languagescmccmcXCheyennechychyWChuvashchvchvcv^V-Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church SlavonicchuchucuUCherokeechrchr!T9Chipewyan; Dene SulinechpchpSChoctawchochoR)Chinook jargonchnchnQMarichmchmPChuukesechkchkOChinesechizhozhNChagataichgchgMChechenchecheceLChibchachbchbKChamorrochachachJ-Celtic languagescelcel $YaG5 nX0iR.xY+Western Frisianfryfryfy +Eastern Frisianfrsfrs -Northern Frisianfrrfrr% AFrench, Old (842-ca. 1400)frofro) IFrench, Middle (ca. 1400-1600)frmfrm FrenchfrefrafrFonfonfon!9Finno-Ugrian languagesfiufiuFinnishfinfinfi1Filipino; PilipinofilfilFijianfijfijfjFantifatfatFaroesefaofaofoFangfanfanEwondoewoewoEweeweeweee~Estonianestestet}Esperantoepoepoeo&|CEnglish, Middle (1100-1500)enmenm{EnglishengengenzElamiteelxelxyEkajukekaekax1Egyptian (Ancient)egyegywEfikefiefivDzongkhadzodzodzuDyuladyudyut)Dutch; Flemishdutnldnl(sGDutch, Middle (ca. 1050-1350)dumdumrDualaduaduaq'Lower Sorbiandsbdsbp3Dravidian languagesdradraoDogridoidoi'nADivehi; Dhivehi; MaldiviandivdivdvmDinkadindinlDogribdgrdgrk1Slave (Athapascan)denden #YhR@(bO8$hR?nY1Hindihinhinhi80gHimachali languages; Western Pahari languageshimhim/!Hiligaynonhilhil.Hereroherherhz-Hebrewhebhebhe,Hawaiianhawhaw+Hausahauhauha$*;Haitian; Haitian Creolehathatht)Haidahaihai(Gwich'ingwigwi'Gujaratigujgujgu,&OSwiss German; Alemannic; Alsatiangswgsw%Guaranigrngrngn"$7Greek, Modern (1453-)greellel##=Greek, Ancient (to 1453)grcgrc"Grebogrbgrb!Gothicgotgot GorontalogorgorGondigongon*KGerman, Old High (ca. 750-1050)gohgoh.SGerman, Middle High (ca. 1050-1500)gmhgmhManxglvglvgvGalicianglgglgglIrishgleglega$;Gaelic; Scottish Gaelicglaglagd!GilbertesegilgilGeezgezgezGermangerdeudeGeorgiangeokatka1Germanic languagesgemgemGbayagbagbaGayogaygay GagaagaaFriulianfurfurFulahfulfulff #Sm[I5 z/hQ9% fSTKambakamkam%S=Kalaallisut; GreenlandickalkalklR+Kachin; JingphokackacQKabylekabkabP#Kara-KalpakkaakaaO%Judeo-ArabicjrbjrbN'Judeo-PersianjprjprMJapanesejpnjpnjaLLojbanjbojboKJavanesejavjavjvJItalianitaitaitI3Iroquoian languagesiroiroH/Iranian languagesirairaGInupiaqipkipkikFIngushinhinh"E;Indo-European languagesineineD!IndonesianindindidC+Indic languagesincincHBInterlingua (International Auxiliary Language Association)inainaiaAIlokoiloilo$@;Interlingue; Occidentalileileie?Inuktitutikuikuiu>'Ijo languagesijoijo=/Sichuan Yi; Nuosuiiiiiiii<Idoidoidoio;Icelandiciceislis:Igboiboiboig9Ibanibaiba8Hupahuphup7Hungarianhunhunhu6'Upper Sorbianhsbhsb5Croatianhrvhrvhr4Hiri Motuhmohmoho3#Hmong; Monghmnhmn2Hittitehithit &mv_L-p\G1pYD0 mzLingalalinlinln-yMLimburgan; Limburger; LimburgishlimlimlixLezghianlezlezwLatvianlavlavlvvLatinlatlatlauLaolaolaolotLambalamlamsLahndalahlahrLadinoladladqKutenaikutkutpKurdishkurkurkuoKumykkumkumn1Kuanyama; KwanyamakuakuakjmKurukhkrukrul'Kru languageskrokrokKareliankrlkrlj+Karachay-BalkarkrckrciKpellekpekpehKosraeankoskosgKoreankorkorkofKongokonkonkgeKomikomkomkvdKonkanikokkokcKimbundukmbkmbb+Kirghiz; Kyrgyzkirkirkya#Kinyarwandakinkinrw`)Kikuyu; Gikuyukikkikki_+Khotanese;Sakankhokho^'Central Khmerkhmkhmkm]/Khoisan languageskhikhi\Khasikhakha[KabardiankbdkbdZKazakhkazkazkkYKawikawkawXKanurikaukaukrWKashmirikaskasksV+Karen languageskarkarUKannadakankankn &W}aL7$u`G1~X;"kW Mohawkmohmoh-Manobo languagesmnomnoManipurimnimniManchumncmncMaltesemltmltmtMalagasymlgmlgmg3Mon-Khmer languagesmkhmkh/Uncoded languagesmismis#Minangkabauminmin+Mi'kmaq; Micmacmicmic#=Irish, Middle (900-1200)mgamgaMendemenmenMandarmdrmdrMokshamdfmdfMalaymaymsamsMasaimasmasMarathimarmarmr!9Austronesian languagesmapmapMaorimaomrimi Mandingomanman Malayalammalmalml Makasarmakmak Maithilimaimai #MarshallesemahmahmhMagahimagmagMaduresemadmad!MacedonianmacmkdmkLushailuslus#=Luo (Kenya and Tanzania)luoluoLundalunlunLuisenoluiluiGandalugluglg%Luba-Katangalublublu!Luba-Lulualualua)~ELuxembourgish; Letzeburgeschltzltzlb}Lozilozloz|Mongolollol{!Lithuanianlitlitlt RtaJ5nAyP<|R'?EPedi; Sepedi; Northern Sothonsonso>N'Konqonqo=Norwegiannornorno<!Norse, Oldnonnon;Nogainognog2:WBokmål, Norwegian; Norwegian Bokmålnobnobnb29WNorwegian Nynorsk; Nynorsk, Norwegiannnonnonn8Niueanniuniu&7CNiger-Kordofanian languagesnicnic6Niasniania53Nepal Bhasa; Newarinewnew4Nepalinepnepne93iLow German; Low Saxon; German, Low; Saxon, Lowndsnds2Ndongandondong*1GNdebele, North; North Ndebelendendend*0GNdebele, South; South Ndebelenblnblnr/)Navajo; Navahonavnavnv.Naurunaunauna-!Neapolitannapnap*,KNorth American Indian languagesnainai+/Nahuatl languagesnahnah*Erzyamyvmyv)+Mayan languagesmynmyn(Marwarimwrmwr'Mirandesemwlmwl&Creekmusmus%+Munda languagesmunmun$1Multiple languagesmulmul#Mossimosmos"Mongolianmonmonmn !3Moldavian; Moldovanmolmolmo VzdN;(gH*`I'V<_oProvençal, Old (to 1500); Occitan, Old (to 1500)propro^/Prakrit languagesprapra]!Portugueseporporpt\Pohnpeianponpon[PolishpolpolplZPalipliplipiY!PhoenicianphnphnX5Philippine languagesphiphiWPersianperfasfa*VKPersian, Old (ca. 600-400 B.C.)peopeoUPalauanpaupauT!PapiamentopappapS-Panjabi; Punjabipanpanpa R7Pampanga; KapampanganpampamQPahlavipalpalP!PangasinanpagpagO-Papuan languagespaapaaN/Otomian languagesotooto'METurkish, Ottoman (1500-1928)otaotaL/Ossetian; OsseticossossosKOsageosaosaJOromoormormomIOriyaorioriorHOjibwaojiojioj G3Occitan (post 1500)ociociocFNzimanzinziENyoronyonyoDNyankolenynnynCNyamwezinymnym$B;Chichewa; Chewa; Nyanjanyanyany>AsClassical Newari; Old Newari; Classical Nepal Bhasanwcnwc@-Nubian languagesnubnub "[rF'p[Hs_@y[-Slavic languagesslasla!9Sino-Tibetan languagessitsit-Siouan languagessiosio~1Sinhala; Sinhalesesinsinsi}Sidamosidsid|Shanshnshn{)Sign Languagessgnsgnz3Irish, Old (to 900)sgasgay/Semitic languagessemsemxSelkupselselwScotsscoscovSicilianscnscnuSantalisatsattSasaksassassSanskritsansansar/Samaritan Aramaicsamsamq1Salishan languagessalsal*pKSouth American Indian languagessaisaioYakutsahsahnSangosagsagsgmSandawesadsadlRussianrusrusru0kWAromanian; Arumanian; Macedo-RomanianruprupjRundirunrunrniRomanianrumronrohRomanyromromgRomanshrohrohrmf/Romance languagesroaroa)eIRarotongan; Cook Islands MaorirarrardRapanuiraprapc!RajasthanirajrajbQuechuaquequequ)a9Reserved for local useqaa-qtzqaa-qtz`)Pushto; Pashtopuspusps ']}fN8  wU<" jS< p](Tetumtettet'Terenoterter&Timnetemtem%Teluguteltelte$Tatartattattt#Tamiltamtamta"'Tai languagestaitai!Tahitiantahtahty Syriacsyrsyr-Classical SyriacsycsycSwedishsweswesvSwahiliswaswaswSumeriansuxsuxSususussusSundanesesunsunsuSukumasuksukSwatisswsswss!9Nilo-Saharan languagesssassaSerersrrsrrSerbiansrpsrpsr%Sranan TongosrnsrnSardiniansrdsrdsc1Spanish; Castilianspaspaes+Sotho, Southernsotsotst/Songhai languagessonsonSomalisomsomsoSogdiansogsog Soninkesnksnk Sindhisndsndsd Shonasnasnasn !Skolt Samismssms Samoansmosmosm!Inari SamismnsmnLule Samismjsmj)Sami languagessmismi'Northern Samismesmese'Southern SamismasmaSlovenianslvslvslSlovaksloslksk 'r~mX5  pYD(nU@&rO1Wakashan languageswakwakNVoticvotvotMVolapükvolvolvoL!VietnamesevievieviKVendavenvenveJVaivaivaiIUzbekuzbuzbuzHUrduurdurdurG%UndeterminedundundFUmbunduumbumbEUkrainianukrukrukD)Uighur; UyghuruiguigugCUgariticugaugaBUdmurtudmudmATuviniantyvtyv@Twitwitwitw?Tuvalutvltvl>-Altaic languagestuttut=Turkishturturtr<)Tupi languagestuptup;Tumbukatumtum:Turkmentuktuktk9Tsongatsotsots8Tswanatsntsntn7Tsimshiantsitsi6Tok Pisintpitpi"57Tonga (Tonga Islands)tontonto4'Tonga (Nyasa)togtog3Tamashektmhtmh2Tlingittlitli 17Klingon; tlhIngan-Holtlhtlh0Tokelautkltkl/Tivtivtiv.Tigrinyatirtirti-Tigretigtig,Tibetantibbodbo+Thaithathath*Tagalogtgltgltl)Tajiktgktgktg oZ?*wcE(9fiZaza; Dimili; Dimli; Kirdki; Kirmanjki; Zazakizzazza0eWNo linguistic content; Not applicablezxxzxxdZunizunzuncZuluzulzulzub+Zande languageszndznda)Zhuang; Chuangzhazhaza`Zenagazenzen,_OBlissymbols; Blissymbolics; Blisszblzbl^Zapoteczapzap]+Yupik languagesypkypk\Yorubayoryoryo[YiddishyidyidyiZYapeseyapyapYYaoyaoyaoXXhosaxhoxhoxhW'Kalmyk; OiratxalxalVWolofwolwolwoUWalloonwlnwlnwaT/Sorbian languageswenwenSWelshwelcymcyRWashowaswasQWaraywarwarP1Wolaitta; Wolayttawalwalpygtkspellcheck-3.0/setup.py0000664000175000017500000000533512013730644017724 0ustar cjenkinscjenkins00000000000000# -*- coding:utf-8 -*- # # Copyright (C) 2012, Maximilian Köhl # Copyright (C) 2012, Carlos Jenkins # # 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 3 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, see . from __future__ import print_function import os import sys from distutils.core import setup cmdclass = {} try: from sphinx.setup_command import BuildDoc cmdclass['build_sphinx'] = BuildDoc except ImportError as e: print(e) print('Unable to import Sphinx custom command. Documentation build will ' 'be unavailable. Install python-sphinx to solve this.') try: from sphinx_pypi_upload import UploadDoc cmdclass['upload_sphinx'] = UploadDoc except ImportError as e: print(e) print('Unable to import Sphinx custom command. Documentation upload ' 'be unavailable. Install http://pypi.python.org/pypi/Sphinx-PyPI-' 'upload/ to solve this.') sys.path.insert(0, './src/') import gtkspellcheck as m if len(sys.argv) > 1 and sys.argv[1] == 'register': m.__desc_long__ = open(os.path.join('.', 'doc', 'pypi', 'page.rst'), 'r').read() print('pypi registration: override `long_description`') setup(name=m.__short_name__, version=m.__version__, description=m.__desc_short__, long_description=m.__desc_long__, author=m.__authors__, author_email=m.__emails__, url=m.__website__, download_url=m.__download_url__, license='GPLv3+', package_dir={'': 'src'}, packages=['gtkspellcheck', 'pylocales'], package_data={'pylocales' : ['locales.db']}, classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: X11 Applications :: Gnome', 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', 'Operating System :: MacOS :: MacOS X', # Should work on MacOS X I think... 'Operating System :: Microsoft :: Windows', 'Operating System :: POSIX', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', 'Topic :: Software Development :: Localization'], cmdclass=cmdclass) pygtkspellcheck-3.0/doc/0000775000175000017500000000000012013730753016752 5ustar cjenkinscjenkins00000000000000pygtkspellcheck-3.0/doc/source/0000775000175000017500000000000012013730753020252 5ustar cjenkinscjenkins00000000000000pygtkspellcheck-3.0/doc/source/index.rst0000664000175000017500000001017112013730013022100 0ustar cjenkinscjenkins00000000000000Python GTK Spellcheck ===================== PyGtkSpellCheck is a spellchecking library written in pure Python for Gtk based on Enchant_. It supports both Gtk's Python bindings, PyGObject_ and PyGtk_, and for both Python 2 and 3 with automatic switching and binding autodetection. For automatic translation of the user interface it can use GEdit's translation files. .. _Enchant: http://www.abisource.com/projects/enchant/ .. _PyGObject: https://live.gnome.org/PyGObject/ .. _PyGtk: http://www.pygtk.org/ Features -------- - Localized names of the available languages. - Supports word, line and multiline ignore regexes. - Supports ignore custom tags on Gtk's TextBuffer. - Enable and disable of spellchecking with preferences memory. - Supports hotswap of Gtk's TextBuffers. - PyGObject and PyGtk compatible with automatic detection. - Python 2 and 3 support. - As Enchant, support for Hunspell (LibreOffice) and Aspell (GNU) dictionaries. Download -------- Source distribution ^^^^^^^^^^^^^^^^^^^ PyPI package available at: http://pypi.python.org/pypi/pygtkspellcheck/ ``pip install pygtkspellcheck`` Ubuntu/Debian ^^^^^^^^^^^^^ Install packages: - Python 3: - ``sudo apt-get install python3-gtkspellcheck`` - https://github.com/downloads/koehlma/pygtkspellcheck/python3-gtkspellcheck_3.0-1_all.deb - Python 2: - ``sudo apt-get install python-gtkspellcheck`` - https://github.com/downloads/koehlma/pygtkspellcheck/python-gtkspellcheck_3.0-1_all.deb - Documentation: - ``sudo apt-get install python-gtkspellcheck-doc`` - https://github.com/downloads/koehlma/pygtkspellcheck/python-gtkspellcheck-doc_3.0-1_all.deb Archlinux ^^^^^^^^^ Available in the `Archlinux User Repository`_: .. _Archlinux User Repository: https://aur.archlinux.org/ - Python 3: - ``yaourt -S python-gtkspellcheck`` - https://aur.archlinux.org/packages.php?ID=61200 - https://github.com/downloads/koehlma/pygtkspellcheck/python-gtkspellcheck-3.0-1-any.pkg.tar.xz - Python 2: - ``yaourt -S python2-gtkspellcheck`` - https://aur.archlinux.org/packages.php?ID=61199 - https://github.com/downloads/koehlma/pygtkspellcheck/python2-gtkspellcheck-3.0-1-any.pkg.tar.xz Hacking ^^^^^^^ Development repository is available at: https://github.com/koehlma/pygtkspellcheck ``git clone git://github.com/koehlma/pygtkspellcheck.git`` Or download last sources in a `ZIP`_ or `Tarball`_ file. .. _ZIP: https://github.com/koehlma/pygtkspellcheck/zipball/master .. _Tarball: https://github.com/koehlma/pygtkspellcheck/tarball/master API Reference ------------- The main object is called Spellchecker and can be associated with any GtkTextView: .. toctree:: :maxdepth: 1 spellchecker This library also includes a utility module to unpack `LibreOffice .oxt extension dictionaries`_ (Hunspell). This is especially useful for MS Windows users to include dictionaries for this library. Use this to extract the Hunspell dictionaries out of the extension and then pass to the Spellchecker the path to the location of the extraction in the params argument with the key ``enchant.myspell.dictionary.path``. .. _LibreOffice .oxt extension dictionaries: http://extensions.services.openoffice.org/dictionary .. toctree:: :maxdepth: 1 oxt_import Examples -------- - `PyGObject Simple Example`_ - `PyGtk Simple Example`_ .. _PyGObject Simple Example: https://github.com/koehlma/pygtkspellcheck/blob/master/examples/simple_pygobject.py .. _PyGtk Simple Example: https://github.com/koehlma/pygtkspellcheck/blob/master/examples/simple_pygtk.py License ------- 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 3 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, see . pygtkspellcheck-3.0/doc/source/conf.py0000664000175000017500000002062612004224443021551 0ustar cjenkinscjenkins00000000000000# -*- coding: utf-8 -*- # # Python GTK Spellchecker documentation build configuration file, created by # sphinx-quickstart2 on Tue Apr 10 18:57:32 2012. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) doc_directory = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(doc_directory, '..', '..', 'src')) import sys # Support for readthedocs.org class Mock(object): def __init__(self, *args, **kwargs): pass def __call__(self, *args, **kwargs): return Mock() @classmethod def __getattr__(self, name): if name in ('__file__', '__path__'): return '/dev/null' elif name[0] == name[0].upper(): return type(name, (), {}) else: return Mock() MOCK_MODULES = ['enchant'] for mod_name in MOCK_MODULES: try: __import__(mod_name) except: sys.modules[mod_name] = Mock() import gtkspellcheck as m start_file = 'index' # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = start_file # General information about the project. project = m.__project__ copyright = m.__authors__ # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = m.__version__ # The full version, including alpha/beta/rc tags. release = m.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". #html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = m.__short_name__ + 'doc' # -- Options for LaTeX output -------------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ (start_file, m.__short_name__ + '.tex', m.__project__ + ' Documentation', m.__authors__.replace('&', r'\&'), 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ (start_file, m.__short_name__, m.__project__ + ' Documentation', m.__authors__.split(' & '), 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------------ # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ (start_file, m.__short_name__, m.__project__ + ' Documentation', m.__authors__, m.__short_name__, m.__desc_short__, 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' pygtkspellcheck-3.0/doc/source/spellchecker.rst0000664000175000017500000000017512004224443023445 0ustar cjenkinscjenkins00000000000000SpellChecker class reference ============================ .. autoclass:: gtkspellcheck.spellcheck.SpellChecker :members: pygtkspellcheck-3.0/doc/source/oxt_import.rst0000664000175000017500000000016012004224443023177 0ustar cjenkinscjenkins00000000000000oxt_import module reference =========================== .. autofunction:: gtkspellcheck.oxt_import.deflate_oxt pygtkspellcheck-3.0/doc/pypi/0000775000175000017500000000000012013730753017733 5ustar cjenkinscjenkins00000000000000pygtkspellcheck-3.0/doc/pypi/page.rst0000664000175000017500000000250012005575210021372 0ustar cjenkinscjenkins00000000000000Python GTK Spellcheck ===================== PyGtkSpellcheck is a simple but quite powerful spellchecking library written in pure Python for Gtk based on Enchant_. It supports PyGObject_ as well as PyGtk_ for Python 2 and 3 with automatic switching and binding detection. For automatic translation of the user interface it can use Gedit’s translation files. .. _Enchant: http://www.abisource.com/projects/enchant/ .. _PyGObject: https://live.gnome.org/PyGObject/ .. _PyGtk: http://www.pygtk.org/ Features ^^^^^^^^ - Localized names of the available languages. - Supports word, line and multiline ignore regexes. - Supports ignore custom tags on Gtk's TextBuffer. - Enable and disable of spellchecking with preferences memory. - Supports hotswap of Gtk's TextBuffers. - PyGObject and PyGtk compatible with automatic detection. - Python 2 and 3 support. - As Enchant, support for Hunspell (LibreOffice) and Aspell (GNU) dictionaries. Documentation ^^^^^^^^^^^^^ You can find the documentation at `Read the Docs`_. .. _Read the Docs: http://pygtkspellcheck.readthedocs.org/ Development ^^^^^^^^^^^ Development happens at `GitHub`_. .. _GitHub: https://github.com/koehlma/pygtkspellcheck License ^^^^^^^ PyGtkSpellcheck is released under `GPLv3`_ or at your opinion any later version. .. _GPLv3: https://www.gnu.org/licenses/gpl-3.0.htmlpygtkspellcheck-3.0/doc/pypi/index.html0000664000175000017500000000076312005575210021732 0ustar cjenkinscjenkins00000000000000 PyGtkSpellcheck - Documentation The documentation has moved to Read the Docs. pygtkspellcheck-3.0/doc/make.bat0000664000175000017500000001202012004224443020344 0ustar cjenkinscjenkins00000000000000@ECHO OFF REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build2 ) set BUILDDIR=build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source set I18NSPHINXOPTS=%SPHINXOPTS% source if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% ) if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^` where ^ is one of echo. html to make standalone HTML files echo. dirhtml to make HTML files named index.html in directories echo. singlehtml to make a single large HTML file echo. pickle to make pickle files echo. json to make JSON files echo. htmlhelp to make HTML files and a HTML help project echo. qthelp to make HTML files and a qthelp project echo. devhelp to make HTML files and a Devhelp project echo. epub to make an epub echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter echo. text to make text files echo. man to make manual pages echo. texinfo to make Texinfo files echo. gettext to make PO message catalogs echo. changes to make an overview over all changed/added/deprecated items echo. linkcheck to check all external links for integrity echo. doctest to run all doctests embedded in the documentation if enabled goto end ) if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* goto end ) if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "singlehtml" ( %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "htmlhelp" ( %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. goto end ) if "%1" == "qthelp" ( %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: echo.^> qcollectiongenerator %BUILDDIR%\qthelp\PythonGTKSpellchecker.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\PythonGTKSpellchecker.ghc goto end ) if "%1" == "devhelp" ( %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp if errorlevel 1 exit /b 1 echo. echo.Build finished. goto end ) if "%1" == "epub" ( %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub if errorlevel 1 exit /b 1 echo. echo.Build finished. The epub file is in %BUILDDIR%/epub. goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex if errorlevel 1 exit /b 1 echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "text" ( %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text if errorlevel 1 exit /b 1 echo. echo.Build finished. The text files are in %BUILDDIR%/text. goto end ) if "%1" == "man" ( %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man if errorlevel 1 exit /b 1 echo. echo.Build finished. The manual pages are in %BUILDDIR%/man. goto end ) if "%1" == "texinfo" ( %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo if errorlevel 1 exit /b 1 echo. echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. goto end ) if "%1" == "gettext" ( %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale if errorlevel 1 exit /b 1 echo. echo.Build finished. The message catalogs are in %BUILDDIR%/locale. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes if errorlevel 1 exit /b 1 echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "linkcheck" ( %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck if errorlevel 1 exit /b 1 echo. echo.Link check complete; look for any errors in the above output ^ or in %BUILDDIR%/linkcheck/output.txt. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest if errorlevel 1 exit /b 1 echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) :end pygtkspellcheck-3.0/doc/insert_metadata.py0000775000175000017500000000433012004246651022472 0ustar cjenkinscjenkins00000000000000#!/usr/bin/env python # -*- coding:utf-8 -*- # # Copyright (C) 2012, Maximilian Köhl # Copyright (C) 2012, Carlos Jenkins # # 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 3 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, see . ENCODING = 'UTF-8' import sys import argparse # Python 2/3 unicode import sys if sys.version_info.major == 3: io_in = lambda x: x io_out = io_in else: io_in = lambda x: x.decode(ENCODING) io_out = lambda x: x.encode(ENCODING) # Pipes Python enconding nightmare if sys.stdout.encoding is None: import codecs sys.stdout = codecs.getwriter(ENCODING)(sys.stdout) # Find metadata dict from os.path import join, dirname sys.path.append(join(dirname(__file__), '../src/')) from gtkspellcheck import __metadata__ # Parse command line parser = argparse.ArgumentParser(description='Insert metadata into plain text files.') parser.add_argument('infile', type=argparse.FileType('r'), help='path to the template file or stdin pipe.') parser.add_argument('-w', '--writeback', action='store_true', help='write the output back to the input file.') args = parser.parse_args() # Read content out_content = io_in(args.infile.read()) args.infile.close() # Replace variables # FIXME: Stop wasting memory like crazy! for key, value in __metadata__.items(): out_content = out_content.replace(key, value) # Print/Write new content if args.writeback: try: with open(args.infile.name, 'w') as out_handler: out_handler.write(io_out(out_content)) except Exception as e: sys.stderr.write(str(e) + '\n') sys.exit(-1) else: print(out_content) sys.exit(0) pygtkspellcheck-3.0/doc/Makefile0000664000175000017500000001300112004224443020377 0ustar cjenkinscjenkins00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PythonGTKSpellchecker.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PythonGTKSpellchecker.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/PythonGTKSpellchecker" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/PythonGTKSpellchecker" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." pygtkspellcheck-3.0/LICENSE.txt0000664000175000017500000010451312004224443020026 0ustar cjenkinscjenkins00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 3 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, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . pygtkspellcheck-3.0/MANIFEST.in0000664000175000017500000000023212004224443017732 0ustar cjenkinscjenkins00000000000000include LICENSE.txt include MANIFEST.in include README.md graft examples graft doc graft l10n prune l10n/mo prune l10n/isos recursive-exclude l10n *.pyc pygtkspellcheck-3.0/l10n/0000775000175000017500000000000012013730753016757 5ustar cjenkinscjenkins00000000000000pygtkspellcheck-3.0/l10n/extract_strings.sh0000775000175000017500000000025012004224443022530 0ustar cjenkinscjenkins00000000000000#!/bin/bash xgettext --keyword=translatable --sort-output -o pygtkspellcheck/en.po \ ../src/gtkspellcheck/spellcheck.py ../src/gtkspellcheck/oxt_import.py echo "Done!" pygtkspellcheck-3.0/l10n/msgfmt2.py0000664000175000017500000001456712004224443020717 0ustar cjenkinscjenkins00000000000000#! /usr/bin/env python # -*- coding: iso-8859-1 -*- # Written by Martin v. Lwis """Generate binary message catalog from textual translation description. This program converts a textual Uniforum-style message catalog (.po file) into a binary GNU catalog (.mo file). This is essentially the same function as the GNU msgfmt program, however, it is a simpler implementation. Usage: msgfmt.py [OPTIONS] filename.po Options: -o file --output-file=file Specify the output file to write to. If omitted, output will go to a file named filename.mo (based off the input file name). -h --help Print this message and exit. -V --version Display version information and exit. """ import sys import os import getopt import struct import array __version__ = "1.1" MESSAGES = {} def usage(code, msg=''): print >> sys.stderr, __doc__ if msg: print >> sys.stderr, msg sys.exit(code) def add(id, str, fuzzy): "Add a non-fuzzy translation to the dictionary." global MESSAGES if not fuzzy and str: MESSAGES[id] = str def generate(): "Return the generated output." global MESSAGES keys = MESSAGES.keys() # the keys are sorted in the .mo file keys.sort() offsets = [] ids = strs = '' for id in keys: # For each string, we need size and file offset. Each string is NUL # terminated; the NUL does not count into the size. offsets.append((len(ids), len(id), len(strs), len(MESSAGES[id]))) ids += id + '\0' strs += MESSAGES[id] + '\0' output = '' # The header is 7 32-bit unsigned integers. We don't use hash tables, so # the keys start right after the index tables. # translated string. keystart = 7*4+16*len(keys) # and the values start after the keys valuestart = keystart + len(ids) koffsets = [] voffsets = [] # The string table first has the list of keys, then the list of values. # Each entry has first the size of the string, then the file offset. for o1, l1, o2, l2 in offsets: koffsets += [l1, o1+keystart] voffsets += [l2, o2+valuestart] offsets = koffsets + voffsets output = struct.pack("Iiiiiii", 0x950412deL, # Magic 0, # Version len(keys), # # of entries 7*4, # start of key index 7*4+len(keys)*8, # start of value index 0, 0) # size and offset of hash table output += array.array("i", offsets).tostring() output += ids output += strs return output def make(filename, outfile): ID = 1 STR = 2 # Compute .mo name from .po name and arguments if filename.endswith('.po'): infile = filename else: infile = filename + '.po' if outfile is None: outfile = os.path.splitext(infile)[0] + '.mo' try: lines = open(infile).readlines() except IOError, msg: print >> sys.stderr, msg sys.exit(1) section = None fuzzy = 0 # Parse the catalog lno = 0 for l in lines: lno += 1 # If we get a comment line after a msgstr, this is a new entry if l[0] == '#' and section == STR: add(msgid, msgstr, fuzzy) section = None fuzzy = 0 # Record a fuzzy mark if l[:2] == '#,' and 'fuzzy' in l: fuzzy = 1 # Skip comments if l[0] == '#': continue # Now we are in a msgid section, output previous section if l.startswith('msgid') and not l.startswith('msgid_plural'): if section == STR: add(msgid, msgstr, fuzzy) section = ID l = l[5:] msgid = msgstr = '' is_plural = False # This is a message with plural forms elif l.startswith('msgid_plural'): if section != ID: print >> sys.stderr, 'msgid_plural not preceeded by msgid on %s:%d' %\ (infile, lno) sys.exit(1) l = l[12:] msgid += '\0' # separator of singular and plural is_plural = True # Now we are in a msgstr section elif l.startswith('msgstr'): section = STR if l.startswith('msgstr['): if not is_plural: print >> sys.stderr, 'plural without msgid_plural on %s:%d' %\ (infile, lno) sys.exit(1) l = l.split(']', 1)[1] if msgstr: msgstr += '\0' # Separator of the various plural forms else: if is_plural: print >> sys.stderr, 'indexed msgstr required for plural on %s:%d' %\ (infile, lno) sys.exit(1) l = l[6:] # Skip empty lines l = l.strip() if not l: continue # XXX: Does this always follow Python escape semantics? l = eval(l) if section == ID: msgid += l elif section == STR: msgstr += l else: print >> sys.stderr, 'Syntax error on %s:%d' % (infile, lno), \ 'before:' print >> sys.stderr, l sys.exit(1) # Add last entry if section == STR: add(msgid, msgstr, fuzzy) # Compute output output = generate() try: open(outfile,"wb").write(output) except IOError,msg: print >> sys.stderr, msg def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'hVo:', ['help', 'version', 'output-file=']) except getopt.error, msg: usage(1, msg) outfile = None # parse options for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-V', '--version'): print >> sys.stderr, "msgfmt.py", __version__ sys.exit(0) elif opt in ('-o', '--output-file'): outfile = arg # do it if not args: print >> sys.stderr, 'No input file given' print >> sys.stderr, "Try `msgfmt --help' for more information." return for filename in args: make(filename, outfile) if __name__ == '__main__': main() pygtkspellcheck-3.0/l10n/compile_mo.py0000775000175000017500000000220112004224443021444 0ustar cjenkinscjenkins00000000000000#!/usr/bin/env python import os import sys import shutil where_am_i = os.path.normpath(os.path.dirname(os.path.abspath(os.path.realpath(__file__)))) os.chdir(where_am_i) if sys.version_info.major == 3: import msgfmt3 as msgfmt else: import msgfmt2 as msgfmt def build_mo_files(): """Compile available localization files""" APP = 'pygtkspellcheck' locale_dir = 'mo' po_dir = 'pygtkspellcheck' if os.path.exists(locale_dir): shutil.rmtree(locale_dir) os.mkdir(locale_dir) available_langs = [f[:-3] for f in os.listdir(po_dir) if f.endswith('.po')] print('Languages: {langs}'.format(langs=str(available_langs))) for lang in available_langs: po_file = os.path.join(po_dir, lang + '.po') lang_dir = os.path.join(locale_dir, lang) mo_dir = os.path.join(lang_dir, 'LC_MESSAGES') mo_file = os.path.join(mo_dir, APP + '.mo') if not os.path.exists(mo_dir): os.makedirs(mo_dir) print('Compiling {0} to {1}'.format(po_file, mo_file)) msgfmt.make(po_file, mo_file) if __name__ == '__main__': build_mo_files() pygtkspellcheck-3.0/l10n/msgfmt3.py0000664000175000017500000001566212004224443020715 0ustar cjenkinscjenkins00000000000000#! /usr/bin/python3.2 # Written by Martin v. Löwis """Generate binary message catalog from textual translation description. This program converts a textual Uniforum-style message catalog (.po file) into a binary GNU catalog (.mo file). This is essentially the same function as the GNU msgfmt program, however, it is a simpler implementation. Usage: msgfmt.py [OPTIONS] filename.po Options: -o file --output-file=file Specify the output file to write to. If omitted, output will go to a file named filename.mo (based off the input file name). -h --help Print this message and exit. -V --version Display version information and exit. """ import sys import os import getopt import struct import array from email.parser import HeaderParser __version__ = "1.1" MESSAGES = {} def usage(code, msg=''): print(__doc__, file=sys.stderr) if msg: print(msg, file=sys.stderr) sys.exit(code) def add(id, str, fuzzy): "Add a non-fuzzy translation to the dictionary." global MESSAGES if not fuzzy and str: MESSAGES[id] = str def generate(): "Return the generated output." global MESSAGES # the keys are sorted in the .mo file keys = sorted(MESSAGES.keys()) offsets = [] ids = strs = b'' for id in keys: # For each string, we need size and file offset. Each string is NUL # terminated; the NUL does not count into the size. offsets.append((len(ids), len(id), len(strs), len(MESSAGES[id]))) ids += id + b'\0' strs += MESSAGES[id] + b'\0' output = '' # The header is 7 32-bit unsigned integers. We don't use hash tables, so # the keys start right after the index tables. # translated string. keystart = 7*4+16*len(keys) # and the values start after the keys valuestart = keystart + len(ids) koffsets = [] voffsets = [] # The string table first has the list of keys, then the list of values. # Each entry has first the size of the string, then the file offset. for o1, l1, o2, l2 in offsets: koffsets += [l1, o1+keystart] voffsets += [l2, o2+valuestart] offsets = koffsets + voffsets output = struct.pack("Iiiiiii", 0x950412de, # Magic 0, # Version len(keys), # # of entries 7*4, # start of key index 7*4+len(keys)*8, # start of value index 0, 0) # size and offset of hash table output += array.array("i", offsets).tostring() output += ids output += strs return output def make(filename, outfile): ID = 1 STR = 2 # Compute .mo name from .po name and arguments if filename.endswith('.po'): infile = filename else: infile = filename + '.po' if outfile is None: outfile = os.path.splitext(infile)[0] + '.mo' try: lines = open(infile, 'rb').readlines() except IOError as msg: print(msg, file=sys.stderr) sys.exit(1) section = None fuzzy = 0 # Start off assuming Latin-1, so everything decodes without failure, # until we know the exact encoding encoding = 'latin-1' # Parse the catalog lno = 0 for l in lines: l = l.decode(encoding) lno += 1 # If we get a comment line after a msgstr, this is a new entry if l[0] == '#' and section == STR: add(msgid, msgstr, fuzzy) section = None fuzzy = 0 # Record a fuzzy mark if l[:2] == '#,' and 'fuzzy' in l: fuzzy = 1 # Skip comments if l[0] == '#': continue # Now we are in a msgid section, output previous section if l.startswith('msgid') and not l.startswith('msgid_plural'): if section == STR: add(msgid, msgstr, fuzzy) if not msgid: # See whether there is an encoding declaration p = HeaderParser() charset = p.parsestr(msgstr.decode(encoding)).get_content_charset() if charset: encoding = charset section = ID l = l[5:] msgid = msgstr = b'' is_plural = False # This is a message with plural forms elif l.startswith('msgid_plural'): if section != ID: print('msgid_plural not preceeded by msgid on %s:%d' % (infile, lno), file=sys.stderr) sys.exit(1) l = l[12:] msgid += b'\0' # separator of singular and plural is_plural = True # Now we are in a msgstr section elif l.startswith('msgstr'): section = STR if l.startswith('msgstr['): if not is_plural: print('plural without msgid_plural on %s:%d' % (infile, lno), file=sys.stderr) sys.exit(1) l = l.split(']', 1)[1] if msgstr: msgstr += b'\0' # Separator of the various plural forms else: if is_plural: print('indexed msgstr required for plural on %s:%d' % (infile, lno), file=sys.stderr) sys.exit(1) l = l[6:] # Skip empty lines l = l.strip() if not l: continue # XXX: Does this always follow Python escape semantics? l = eval(l) if section == ID: msgid += l.encode(encoding) elif section == STR: msgstr += l.encode(encoding) else: print('Syntax error on %s:%d' % (infile, lno), \ 'before:', file=sys.stderr) print(l, file=sys.stderr) sys.exit(1) # Add last entry if section == STR: add(msgid, msgstr, fuzzy) # Compute output output = generate() try: open(outfile,"wb").write(output) except IOError as msg: print(msg, file=sys.stderr) def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'hVo:', ['help', 'version', 'output-file=']) except getopt.error as msg: usage(1, msg) outfile = None # parse options for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-V', '--version'): print("msgfmt.py", __version__, file=sys.stderr) sys.exit(0) elif opt in ('-o', '--output-file'): outfile = arg # do it if not args: print('No input file given', file=sys.stderr) print("Try `msgfmt --help' for more information.", file=sys.stderr) return for filename in args: make(filename, outfile) if __name__ == '__main__': main() pygtkspellcheck-3.0/l10n/pygtkspellcheck/0000775000175000017500000000000012013730753022153 5ustar cjenkinscjenkins00000000000000pygtkspellcheck-3.0/l10n/pygtkspellcheck/es.po0000664000175000017500000000474712004224443023130 0ustar cjenkinscjenkins00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: pygtkspellcheck_3.0a\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2012-07-23 05:23-0600\n" "PO-Revision-Date: 2012-07-23 05:26-0600\n" "Last-Translator: Carlos Jenkins \n" "Language-Team: Carlos Jenkins \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Language: Spanish\n" #: ../src/gtkspellcheck/spellcheck.py:412 msgid "(no suggestions)" msgstr "(sin sugerencias)" #: ../src/gtkspellcheck/spellcheck.py:433 #: ../src/gtkspellcheck/spellcheck.py:436 msgid "Add \"{word}\" to Dictionary" msgstr "Agregar \"{word}\" al Diccionario" #: ../src/gtkspellcheck/spellcheck.py:440 #: ../src/gtkspellcheck/spellcheck.py:442 msgid "Ignore All" msgstr "Ignorar Todos" #: ../src/gtkspellcheck/spellcheck.py:457 #: ../src/gtkspellcheck/spellcheck.py:459 msgid "Languages" msgstr "Idiomas" #: ../src/gtkspellcheck/spellcheck.py:470 #: ../src/gtkspellcheck/spellcheck.py:473 msgid "Suggestions" msgstr "Sugerencias" #: ../src/gtkspellcheck/oxt_import.py:138 msgid "'{0}' declared in registry but not found within the extension." msgstr "'{0}' ha sido declarado en el archivo de registro pero no pudo ser encontrado dentro de la extensión." #: ../src/gtkspellcheck/oxt_import.py:141 msgid "Error while processing extension {0}." msgstr "Hubo un error al procesar la extensión {0}." #: ../src/gtkspellcheck/oxt_import.py:144 msgid "Extension '{0}' has no dictionary registry." msgstr "La extensión '{0}' no tiene un archivo de registro de diccionarios." #: ../src/gtkspellcheck/oxt_import.py:146 msgid "Extension '{0}' is not a valid zip file." msgstr "La extensión '{0}' no es un archivo zip válido." #: ../src/gtkspellcheck/oxt_import.py:86 msgid "Extract path is not a directory." msgstr "La ruta de extracción no es un directorio." #: ../src/gtkspellcheck/oxt_import.py:160 msgid "Unable to move extension, file with same name exists within move_path." msgstr "No fue posible mover el archivo de la extensión, un archivo del mismo nombre ya existe dentro de move_path." #: ../src/gtkspellcheck/oxt_import.py:162 msgid "Unable to move extension, move_path is not a directory." msgstr "No fue posible mover el archivo de la extensión, move_path no es un directorio." pygtkspellcheck-3.0/l10n/pygtkspellcheck/en.po0000664000175000017500000000356212004224443023115 0ustar cjenkinscjenkins00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2012-07-23 14:00+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: ../src/gtkspellcheck/spellcheck.py:412 msgid "(no suggestions)" msgstr "" #: ../src/gtkspellcheck/spellcheck.py:433 #: ../src/gtkspellcheck/spellcheck.py:436 msgid "Add \"{word}\" to Dictionary" msgstr "" #: ../src/gtkspellcheck/spellcheck.py:440 #: ../src/gtkspellcheck/spellcheck.py:442 msgid "Ignore All" msgstr "" #: ../src/gtkspellcheck/spellcheck.py:457 #: ../src/gtkspellcheck/spellcheck.py:459 msgid "Languages" msgstr "" #: ../src/gtkspellcheck/spellcheck.py:470 #: ../src/gtkspellcheck/spellcheck.py:473 msgid "Suggestions" msgstr "" #: ../src/gtkspellcheck/oxt_import.py:138 msgid "'{0}' declared in registry but not found within the extension." msgstr "" #: ../src/gtkspellcheck/oxt_import.py:141 msgid "Error while processing extension {0}." msgstr "" #: ../src/gtkspellcheck/oxt_import.py:144 msgid "Extension '{0}' has no dictionary registry." msgstr "" #: ../src/gtkspellcheck/oxt_import.py:146 msgid "Extension '{0}' is not a valid zip file." msgstr "" #: ../src/gtkspellcheck/oxt_import.py:86 msgid "Extract path is not a directory." msgstr "" #: ../src/gtkspellcheck/oxt_import.py:160 msgid "Unable to move extension, file with same name exists within move_path." msgstr "" #: ../src/gtkspellcheck/oxt_import.py:162 msgid "Unable to move extension, move_path is not a directory." msgstr "" pygtkspellcheck-3.0/l10n/pygtkspellcheck/de.po0000664000175000017500000000460112004224443023076 0ustar cjenkinscjenkins00000000000000msgid "" msgstr "" "Project-Id-Version: gtkspellchecker\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2012-07-23 00:08+0100\n" "PO-Revision-Date: 2012-07-23 00:08+0100\n" "Last-Translator: Maximilian Köhl \n" "Language-Team: \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-KeywordsList: _;gettext;gettext_noop\n" "X-Poedit-Basepath: /home/maximilian/Entwicklung/pygtkspellcheck/src\n" "X-Poedit-Language: German\n" "X-Poedit-SourceCharset: utf-8\n" "X-Poedit-SearchPath-0: ./gtkspellcheck\n" #: ../src/gtkspellcheck/spellcheck.py:412 msgid "(no suggestions)" msgstr "(keine Vorschläge)" #: ../src/gtkspellcheck/spellcheck.py:433 #: ../src/gtkspellcheck/spellcheck.py:436 msgid "Add \"{word}\" to Dictionary" msgstr "\"{word}\" zum Wörterbuch hinzufügen" #: ../src/gtkspellcheck/spellcheck.py:440 #: ../src/gtkspellcheck/spellcheck.py:442 msgid "Ignore All" msgstr "Alles ignorieren" #: ../src/gtkspellcheck/spellcheck.py:457 #: ../src/gtkspellcheck/spellcheck.py:459 msgid "Languages" msgstr "Sprachen" #: ../src/gtkspellcheck/spellcheck.py:470 #: ../src/gtkspellcheck/spellcheck.py:473 msgid "Suggestions" msgstr "Vorschläge" #: ../src/gtkspellcheck/oxt_import.py:138 msgid "'{0}' declared in registry but not found within the extension." msgstr "'{0}' wurde in der Wörterbuch Datenbank angegeben, kann aber nicht gefunden werden." #: ../src/gtkspellcheck/oxt_import.py:141 msgid "Error while processing extension {0}." msgstr "Fehler beim Bearbeiten der Erweiterung {0}." #: ../src/gtkspellcheck/oxt_import.py:144 msgid "Extension '{0}' has no dictionary registry." msgstr "Erweiterung '{0}' hat keine Wörterbuch Datenbank." #: ../src/gtkspellcheck/oxt_import.py:146 msgid "Extension '{0}' is not a valid zip file." msgstr "Erweiterung '{0}' ist keine Zip-Datei." #: ../src/gtkspellcheck/oxt_import.py:86 msgid "Extract path is not a directory." msgstr "Ziel ist kein Verzeichnis." #: ../src/gtkspellcheck/oxt_import.py:160 msgid "Unable to move extension, file with same name exists within move_path." msgstr "Die Erweiterung konnte nicht verschoben werden, eine Datei mit gleichem Namen existiert bereits." #: ../src/gtkspellcheck/oxt_import.py:162 msgid "Unable to move extension, move_path is not a directory." msgstr "Die Erweiterung konnte nicht verschoben werden, Ziel ist kein Verzeichnis." pygtkspellcheck-3.0/examples/0000775000175000017500000000000012013730753020023 5ustar cjenkinscjenkins00000000000000pygtkspellcheck-3.0/examples/large_pygobject.py0000664000175000017500000000305312013730013023523 0ustar cjenkinscjenkins00000000000000# -*- coding:utf-8 -*- # # Copyright (C) 2012, Maximilian Köhl # Copyright (C) 2012, Carlos Jenkins # # 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 3 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, see . # Load example if running from source, ignore this import sys from os.path import join, dirname sys.path.append(join(dirname(__file__), '../src/')) import locale from gi.repository import Gtk as gtk from gtkspellcheck import SpellChecker if __name__ == '__main__': def quit(*args): gtk.main_quit() window = gtk.Window.new(gtk.WindowType.TOPLEVEL) window.set_title('PyGtkSpellCheck Example') view = gtk.TextView.new() spellchecker = SpellChecker(view, locale.getdefaultlocale()[0], collapse=False) for code, name in spellchecker.languages: print('code: %5s, language: %s' % (code, name)) window.set_default_size(600, 400) window.add(view) window.show_all() window.connect('delete-event', quit) gtk.main()pygtkspellcheck-3.0/examples/large_pygtk.py0000664000175000017500000000300512013730013022670 0ustar cjenkinscjenkins00000000000000# -*- coding:utf-8 -*- # # Copyright (C) 2012, Maximilian Köhl # Copyright (C) 2012, Carlos Jenkins # # 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 3 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, see . # Load example if running from source, ignore this import sys from os.path import join, dirname sys.path.append(join(dirname(__file__), '../src/')) import locale import gtk from gtkspellcheck import SpellChecker if __name__ == '__main__': def quit(*args): gtk.main_quit() window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_title('PyGtkSpellCheck Example') view = gtk.TextView() spellchecker = SpellChecker(view, locale.getdefaultlocale()[0], collapse=False) for code, name in spellchecker.languages: print('code: %5s, language: %s' % (code, name)) window.set_default_size(600, 400) window.add(view) window.show_all() window.connect('delete-event', quit) gtk.main()pygtkspellcheck-3.0/examples/simple_pygtk.py0000664000175000017500000000276612013730013023104 0ustar cjenkinscjenkins00000000000000# -*- coding:utf-8 -*- # # Copyright (C) 2012, Maximilian Köhl # Copyright (C) 2012, Carlos Jenkins # # 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 3 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, see . # Load example if running from source, ignore this import sys from os.path import join, dirname sys.path.append(join(dirname(__file__), '../src/')) import locale import gtk from gtkspellcheck import SpellChecker if __name__ == '__main__': def quit(*args): gtk.main_quit() window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_title('PyGtkSpellCheck Example') view = gtk.TextView() spellchecker = SpellChecker(view, locale.getdefaultlocale()[0]) for code, name in spellchecker.languages: print('code: %5s, language: %s' % (code, name)) window.set_default_size(600, 400) window.add(view) window.show_all() window.connect('delete-event', quit) gtk.main() pygtkspellcheck-3.0/examples/simple_pygobject.py0000664000175000017500000000303312013730013023720 0ustar cjenkinscjenkins00000000000000# -*- coding:utf-8 -*- # # Copyright (C) 2012, Maximilian Köhl # Copyright (C) 2012, Carlos Jenkins # # 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 3 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, see . # Load example if running from source, ignore this import sys from os.path import join, dirname sys.path.append(join(dirname(__file__), '../src/')) import locale from gi.repository import Gtk as gtk from gtkspellcheck import SpellChecker if __name__ == '__main__': def quit(*args): gtk.main_quit() window = gtk.Window.new(gtk.WindowType.TOPLEVEL) window.set_title('PyGtkSpellCheck Example') view = gtk.TextView.new() spellchecker = SpellChecker(view, locale.getdefaultlocale()[0]) for code, name in spellchecker.languages: print('code: %5s, language: %s' % (code, name)) window.set_default_size(600, 400) window.add(view) window.show_all() window.connect('delete-event', quit) gtk.main()