def build_mapping(langmgr, docmanager): global MAPPINGS try: for lang in langmgr.get_available_langs(): for data in docmanager.itervalues(): lmatch = lang.props.name.lower() if lmatch == data.internal.lower() or \ lmatch == data.human.lower() or \ any((lmatch == x.lower() for x in data.aliases)): MAPPINGS[data.internal] = lang data.inc_support() except SystemError: from pida.core.locale import Locale locale = Locale('medit') _ = locale.gettext import warnings warnings.warn( _("Your medit is to old for full support. Please upgrade to 0.9.5") )
from kiwi.python import enum # PIDA Imports from pida.core.service import Service from pida.core.features import FeaturesConfig from pida.core.events import EventsConfig from pida.core.actions import ActionsConfig from pida.core.actions import (TYPE_NORMAL, TYPE_MENUTOOL, TYPE_RADIO, TYPE_REMEMBER_TOGGLE) from pida.ui.views import PidaView, WindowConfig from pida.utils.unique import create_unique_id # locale from pida.core.locale import Locale locale = Locale('checklist') _ = locale.gettext #Critical, Major, Minor, Warning, Normal class ChecklistStatus(enum): (LOW, NORMAL, HIGH) = range(3) def __new__(cls, value, name): self = enum.__new__(cls, value, name) self.value = value return self class ChecklistItem(object): def __init__(self,
from pida.core.service import Service from pida.core.features import FeaturesConfig from pida.core.events import EventsConfig from pida.core.actions import (ActionsConfig, TYPE_NORMAL) from pida.core.options import OptionsConfig from pida.ui.views import PidaView, WindowConfig from pida.services.language import DOCTYPES from pida.core.indexer import Result from pygtkhelpers.gthreads import gcall import time # locale from pida.core.locale import Locale locale = Locale('') _ = locale.gettext class QItem(object): name = '' path = '' class QOpenView(PidaView): key = 'qopen.view' gladefile = 'qopen' label_text = _('Quick Open') def create_ui(self): self._history = gtk.ListStore(gobject.TYPE_STRING) self.filter.set_model(self._history)
from .outlinefilter import FILTERMAP from pida.core.environment import on_windows from pida.core.languages import LANGUAGE_PLUGIN_TYPES from pygtkhelpers.gthreads import GeneratorTask # ui from pida.ui.views import PidaView from pida.ui.prioritywindow import Category, Entry, PriorityEditorView from pida.core.languages import (PRIO_DEFAULT, PRIO_FOREGROUND, PRIO_FOREGROUND_HIGH, PRIO_LOW) # locale from pida.core.locale import Locale locale = Locale('plugins') _ = locale.gettext class LanguageEntry(Entry): @classmethod def from_plugin(cls, plugin): return cls(uid=plugin.func.uuid(), display=plugin.func.name, plugin=plugin.func.plugin, description=plugin.func.description) def uuid(self): return self.uid
# core from pida.core import environment #from pida.core.service import Service #from pida.core.events import EventsConfig #from pida.core.actions import ActionsConfig, TYPE_NORMAL from pida.core.options import OptionsConfig from pida.core.log import Log from pida.core.languages import (LanguageService, Validator, External) from pida.utils.languages import (LANG_PRIO, Definition, Suggestion, Documentation, ValidationError) # locale from pida.core.locale import Locale locale = Locale('skeleton') _ = locale.gettext # log import logging log = logging.getLogger('python_lint') try: #import pylint from pylint.reporters import BaseReporter from pylint.lint import PyLinter from pylint.interfaces import IReporter from pylint.utils import MSG_TYPES, get_module_and_frameid except ImportError: pylint = None
import gtk import os from gtk import gdk # PIDA Imports import pida from pida.core.service import Service from pida.core.features import FeaturesConfig from pida.core.actions import ActionsConfig from pida.core.actions import TYPE_NORMAL # locale from pida.core.locale import Locale locale = Locale('help') _ = locale.gettext #FIXME: this seems so wrong, but how to detect the docs directory correctly prefix_lst = [] def build_path(prefix): return os.path.abspath(os.path.join(prefix, "share", "doc", "pida", "html")) if __file__.find('site-packages') != -1: prefix_lst.append(build_path( os.path.join(__file__[:__file__.find('site-packages')], os.pardir, os.pardir))) if __file__.find('dist-packages') != -1: prefix_lst.append(build_path( os.path.join(__file__[:__file__.find('dist-packages')],
""" import gtk from pygtkhelpers.ui.objectlist import ObjectTree, Column # PIDA Imports from pida.core.service import Service from pida.core.features import FeaturesConfig from pida.core.actions import ActionsConfig, TYPE_TOGGLE from pida.core.events import EventsConfig from pida.ui.views import PidaView, WindowConfig # locale from pida.core.locale import Locale locale = Locale('shortcuts') _ = locale.gettext class ServiceListItem(object): def __init__(self, svc): self.svc = svc self.label = self.no_mnemomic_label = svc.get_name().capitalize() self.doc = '' self.value = '' self.stock_id = '' def __repr__(self): return '<SLI %s>' % self.label.lower() class ShortcutsView(PidaView):
from textwrap import wrap import gtk # PIDA Imports from pida.core.service import Service from pida.core.events import EventsConfig from pida.core.actions import ActionsConfig from pida.core.actions import TYPE_TOGGLE from pida.ui.views import PidaView from pida.ui.widgets import get_widget_for_type, get_proxy_for_widget # locale from pida.core.locale import Locale locale = Locale('optionsmanager') _ = locale.gettext class OptionsPage(gtk.VBox): #XXX: this should be a slaveview # it should try to use the options.ui from a service # and add other items below def __init__(self, view, svc): gtk.VBox.__init__(self, spacing=0) self.set_border_width(6) self.view = view self.svc = svc self.widgets = {} self.proxies = {}
# PIDA Imports from pida.core.service import Service from pida.core.features import FeaturesConfig from pida.core.commands import CommandsConfig from pida.core.events import EventsConfig from pida.core.actions import ActionsConfig from pida.core.actions import (TYPE_NORMAL, TYPE_MENUTOOL, TYPE_RADIO, TYPE_REMEMBER_TOGGLE) from pida.ui.views import PidaView from pida.utils.web import fetch_url # locale from pida.core.locale import Locale locale = Locale('pastebin') _ = locale.gettext class Bin(object): """ A Pastebin """ PASTE_URL = None def __init__(self, svc): self.svc = svc def create_data_dict(self, title, name, content, syntax): """ Has to return a dict containing the POST data to send to the pastebin. Override this in individual pastebins.
""" import os import gtk # PIDA Imports from pida.core.service import Service from pida.core.options import OptionsConfig from pida.core.actions import ActionsConfig from pida.core.pdbus import DbusConfig, SIGNAL, EXPORT, BUS, DBUS_NS from pida.core.environment import workspace_name from json import loads, dumps # locale from pida.core.locale import Locale locale = Locale('appcontroller') _ = locale.gettext LEXPORT = EXPORT(suffix='appcontroller') LSIGNAL = SIGNAL(suffix='appcontroller') class AppcontrollerConfig(OptionsConfig): def create_options(self): self.create_option( 'open_workspace_manager', _('Always show workspace manager'), bool, False, _('Always open the workspace manager when no workspace name is given'),
filesearch.filters ~~~~~~~~~~~~~~~~~~ :copyright: 2007 by Benjamin Wiegand. :license: GNU GPL, see LICENSE for more details. """ import re import gtk import sre_constants from glob import fnmatch from os.path import basename from pida.core.locale import Locale locale = Locale('filesearch') _ = locale.gettext BINARY_RE = re.compile(r'[\000-\010\013\014\016-\037\200-\377]|\\x00') class ValidationError(Exception): """ An exception that is raised if the user entered invalid data into a filter's field. The search catches it and informs the user. """ class Filter(object): """
try: import webkit except ImportError: webkit = None # PIDA Imports from pida.core.service import Service from pida.core.features import FeaturesConfig from pida.core.commands import CommandsConfig from pida.core.actions import ActionsConfig from pida.ui.views import PidaView # locale from pida.core.locale import Locale locale = Locale('browseweb') _ = locale.gettext def get_url_mark(url): try: url, mark = url.rsplit('#', 1) except: mark = None return url, mark class SearchBar(gtk.HBox): def __init__(self, html, label='Find:'): gtk.HBox.__init__(self) self.html = html
from pygtkhelpers.utils import gsignal from pygtkhelpers.ui.objectlist import Column, ObjectList from pida.ui.views import PidaView, WindowConfig from pida.core.commands import CommandsConfig from pida.core.service import Service from pida.core.features import FeaturesConfig from pida.core.options import OptionsConfig, choices from pida.core.actions import (ActionsConfig, TYPE_NORMAL, TYPE_MENUTOOL, TYPE_REMEMBER_TOGGLE) from pida.ui.buttons import create_mini_button from pygtkhelpers.gthreads import gcall # locale from pida.core.locale import Locale _locale = Locale('notify') _ = _locale.gettext import pynotify pynotify.init('PIDA') from logbook.handlers import Handler, StreamHandler from pida.core.log import rollover class MainloopSendHandler(Handler): def __init__(self, handlers): Handler.__init__(self) self.handlers = handlers def _in_mainloop(self, record):
from pygtkhelpers.gthreads import GeneratorTask, gcall from pygtkhelpers.ui.objectlist import ObjectList, Column # PIDA Imports from pida.core.environment import home from pida.core.service import Service from pida.core.actions import ActionsConfig from pida.core.features import FeaturesConfig from pida.core.actions import TYPE_REMEMBER_TOGGLE, TYPE_NORMAL from pida.ui.views import PidaView, WindowConfig # locale from pida.core.locale import Locale locale = Locale('rfc') _ = locale.gettext class RfcItem(object): def __init__(self, number='0000', data=''): self.number = number self.data = data list = re.split('\(([^\(]*)\)', data) self.description = list[0] class RfcView(PidaView): key = 'rfc.list'
from pida.core.options import OptionsConfig from pida.core.events import EventsConfig from pida.core.actions import ActionsConfig, TYPE_NORMAL, TYPE_MENUTOOL, \ TYPE_TOGGLE from pida.core.projects import Project from pida.ui.views import WindowConfig from pida.core.pdbus import DbusConfig, EXPORT from pida.core import environment from pygtkhelpers.gthreads import AsyncTask, gcall from pida.core.projects import REFRESH_PRIORITY # locale from pida.core.locale import Locale locale = Locale('project') _ = locale.gettext from .views import ProjectListView, ProjectSetupView LEXPORT = EXPORT(suffix='project') def open_directory_dialog(parent, title, folder=''): filechooser = gtk.FileChooserDialog(title, parent, gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK)) filechooser.set_default_response(gtk.RESPONSE_OK) if folder:
from pida.core.service import Service from pida.core.features import FeaturesConfig from pida.core.commands import CommandsConfig from pida.core.options import OptionsConfig, choices from pida.core.events import EventsConfig from pida.core.actions import ActionsConfig from pida.core.pdbus import DbusConfig, EXPORT from pida.ui.views import WindowConfig from pida.core.document import Document, DocumentException from pygtkhelpers.gthreads import gcall # locale from pida.core.locale import Locale locale = Locale('buffer') _ = locale.gettext from .view import BufferListView, attributes LEXPORT = EXPORT(suffix='buffer') class BufferActionsConfig(ActionsConfig): def create_actions(self): self.create_action( 'open_file', gtk.Action, _('_Open File'), _('Open a file with a graphical file browser'), gtk.STOCK_OPEN,
from pygtkhelpers.ui.objectlist import ObjectList, Column # PIDA Imports from pida.core.service import Service from pida.core.actions import ActionsConfig from pida.core.features import FeaturesConfig from pida.core.actions import TYPE_REMEMBER_TOGGLE from pida.ui.views import PidaView, WindowConfig from pida.utils.gthreads import GeneratorSubprocessTask # locale from pida.core.locale import Locale locale = Locale('man') _ = locale.gettext class ManItem(object): def __init__(self, pattern, number, description, search): self.pattern = pattern self.number = number self.description = self._color_match(cgi.escape(description), search) patternmark = self._color_match(cgi.escape(pattern), search) self.markup = '%s(<span color="#0000cc">%d</span>)' % ( patternmark, int(self.number)) def _color_match(self, data, match): return data.replace(match, '<span color="#c00000"><b>%s</b></span>' % match)
# PIDA Imports # core from pida.core.service import Service from pida.core.events import EventsConfig from pida.core.actions import ActionsConfig, TYPE_NORMAL from pida.core.options import OptionsConfig from pida.core.languages import (LanguageService, Outliner, Validator, Completer, LanguageServiceFeaturesConfig, LanguageInfo, Definer, Documentator) from pida.utils.languages import LANG_PRIO, OutlineItem # locale from pida.core.locale import Locale locale = Locale('python') _ = locale.gettext from subprocess import Popen, PIPE def build_language_list(typemanager): """ Build a list of language internal names from the output of ctags --list-languages """ try: output = Popen(["ctags", "--list-languages"], stdout=PIPE).communicate()[0] except OSError as e: # can't find ctags -> no support :-) return []
from pida.core.languages import LanguageService {% else %} from pida.core.service import Service {% endif %} from pida.core.features import FeaturesConfig from pida.core.commands import CommandsConfig from pida.core.events import EventsConfig from pida.core.actions import (ActionsConfig, TYPE_NORMAL, TYPE_MENUTOOL, TYPE_RADIO, TYPE_TOGGLE) from pida.core.options import OptionsConfig from pida.core.pdbus import DbusConfig # locale from pida.core.locale import Locale locale = Locale('{{plugin}}') _ = locale.gettext class {{classname}}EventsConfig(EventsConfig): def create(self): #self.publish('something') pass def subscribe_all_foreign(self): #self.subscribe_foreign('buffer', 'document-changed', # self.on_document_changed) pass def on_document_changed(self, document):
# PIDA Imports from pida.core.service import Service from pida.core.commands import CommandsConfig from pida.core.events import EventsConfig from pida.core.options import OptionsConfig, Color from pida.core.actions import ActionsConfig, global_accelerator_group from pida.core.actions import TYPE_NORMAL, TYPE_TOGGLE, TYPE_REMEMBER_TOGGLE, TYPE_MENUTOOL from pida.core.document import Document from pida.core.features import FeaturesConfig from pida.core.environment import workspace_name, settings_dir from pida.utils import json # locale from pida.core.locale import Locale locale = Locale('window') _ = locale.gettext def window_config(): return settings_dir() / 'window_extra_window-config.json' def load_window_config(): return json.load(window_config(), fallback={}) class ActionWindowMapping(list): """ Specialised mapping for persitant shortcuts on plugin windows """
from pida.core.events import EventsConfig from pida.core.actions import ActionsConfig from pida.core.options import OptionsConfig from pida.core.actions import TYPE_NORMAL, TYPE_MENUTOOL, TYPE_RADIO, TYPE_TOGGLE, TYPE_REMEMBER_TOGGLE from pida.ui.views import PidaView from regextoolkitlib import flags_from_dict, all_matches, capture_groups import re import gtk import gobject import pango import itertools # locale from pida.core.locale import Locale locale = Locale('regextoolkit') _ = locale.gettext class RegextoolkitView(PidaView): key="gregextoolkitwindow.form" gladefile="gregextoolkitwindow" locale = locale label_text = _('RegexToolkit') #icon_name = 'search' running = False def create_ui(self): #self.gregextoolkitwindow.show() self.btnRegexLib.set_sensitive(False)
# -*- coding: utf-8 -*- """ :copyright: 2005-2008 by The PIDA Project :license: GPL 2 or later (see README/COPYING/LICENSE) """ # PIDA Imports from pida.core.service import Service from pida.core.events import EventsConfig from pida.core.options import OptionsConfig, choices # locale from pida.core.locale import Locale locale = Locale('editor') _ = locale.gettext class EditorOptionsConfig(OptionsConfig): def create_options(self): self.create_option( 'editor_type', _('Editor Type'), choices(['vim', 'emacs', 'mooedit']), 'vim', _('The Editor used'), ) class EditorEvents(EventsConfig):
import gobject import os from os.path import exists, isdir, isfile # PIDA Imports from pida.core.service import Service from pida.core.features import FeaturesConfig from pida.core.commands import CommandsConfig from pida.core.events import EventsConfig from pida.core.actions import ActionsConfig from pida.core.options import OptionsConfig # locale from pida.core.locale import Locale locale = Locale('filewatcher') _ = locale.gettext import gio class FilewatcherEvents(EventsConfig): def subscribe_all_foreign(self): self.subscribe_foreign('filemanager', 'browsed_path_changed', self.svc.on_browsed_path_changed) class FileWatcherOptions(OptionsConfig): def create_options(self): self.create_option('enable_filemon', _('Enable FileMonitor'),
from glob import fnmatch from pygtkhelpers.ui.objectlist import Column from pida.ui.views import PidaView from pida.core.commands import CommandsConfig from pida.core.service import Service from pida.core.events import EventsConfig from pida.core.options import OptionsConfig from pida.core.features import FeaturesConfig from pida.core.actions import ActionsConfig from pygtkhelpers.gthreads import GeneratorTask # locale from pida.core.locale import Locale locale = Locale('grepper') _ = locale.gettext class GrepperItem(object): """ A match item in grepper. Contains the data for the matches path, and linenumber that if falls on, as well as actual line of code that matched, and the matches data. """ def __init__(self, path, manager, linenumber=None, line=None,
from . import pidanose # core from pida.core.service import Service from pida.core.actions import ActionsConfig, TYPE_NORMAL, TYPE_TOGGLE from pygtkhelpers.ui.objectlist import Column, Cell # ui from pida.ui.views import PidaView # utils from pygtkhelpers.gthreads import GeneratorTask, AsyncTask, gcall # locale from pida.core.locale import Locale locale = Locale('nosetest') _ = locale.gettext status_map= { # 1 is for sucess, 2 for fail # used for fast tree updates 'success': 'gtk-apply', 'failure': 'gtk-no', 'error': 'gtk-cancel', 'mixed': 'gtk-dialog-warning', 'running': 'gtk-refresh', } mapping = { 'success': 'add_success',
from pida.core.features import FeaturesConfig from pida.core.commands import CommandsConfig from pida.core.events import EventsConfig from pida.core.actions import ActionsConfig from pida.core.actions import (TYPE_NORMAL, TYPE_MENUTOOL, TYPE_RADIO, TYPE_REMEMBER_TOGGLE) from pida.core.editors import LineMarker, MarkerInterface from pida.ui.views import PidaView, WindowConfig from pygtkhelpers.gthreads import GeneratorTask, AsyncTask, gcall # locale from pida.core.locale import Locale locale = Locale('bookmark') _ = locale.gettext class BookmarkItem(object): group = None keys = 'data', 'group', 'title' def __init__(self, title, data): self.title = title self.data = data def run(self, service): pass def _key(self):
import pango import gtk from pida.utils import ostools # PIDA Imports import pida from pida.core.service import Service from pida.core.features import FeaturesConfig from pida.core.commands import CommandsConfig from pida.core.events import EventsConfig from pida.core.actions import ActionsConfig from pida.core.options import OptionsConfig # locale from pida.core.locale import Locale locale = Locale('commander') _ = locale.gettext from .views import TerminalView, PythonView class CommanderOptionsConfig(OptionsConfig): def create_options(self): self.create_option( 'font', _('Terminal Font'), pango.Font, 'Monospace 10', _('The font used in terminals'), )
from pygtkhelpers.gthreads import GeneratorTask, AsyncTask, gcall from pida.utils.path import homedir from pida.ui.views import PidaView, WindowConfig from pida.ui.dropdownmenutoolbutton import DropDownMenuToolButton from pygtkhelpers.ui.widgets import AttrSortCombo from pygtkhelpers.ui.objectlist import Column, ObjectList from pygtkhelpers.ui import dialogs import filehiddencheck # locale from pida.core.locale import Locale locale = Locale('filemanager') _ = locale.gettext IEXPORT = EXPORT(suffix='filemanager') state_text = dict( hidden=' ', none='?', new='A', #XXX added='A', modified='M', ignored=' ', normal=' ', error='E', empty='!', conflict='C',
:copyright: 2005-2008 by The PIDA Project :license: GPL 2 or later (see README/COPYING/LICENSE) """ import os import sys from pida.core.service import Service from pida.core import environment # log import logbook log = logbook.Logger('Pida Servicemanager') # locale from pida.core.locale import Locale locale = Locale('pida') _ = locale.gettext class ServiceLoadingError(ImportError): """An error loading a service""" class ServiceModuleError(ServiceLoadingError): """No Service class in service module""" class ServiceDependencyError(ServiceLoadingError): """Service does not have the necessary dependencies to start"""
# PIDA Imports from pida.core.service import Service from pida.core.features import FeaturesConfig from pida.core.commands import CommandsConfig from pida.core.events import EventsConfig from pida.core.actions import ActionsConfig from pida.core.actions import (TYPE_NORMAL, TYPE_MENUTOOL, TYPE_RADIO, TYPE_REMEMBER_TOGGLE) from pida.ui.views import PidaView, WindowConfig # locale from pida.core.locale import Locale locale = Locale('todo') _ = locale.gettext class TodoItem(object): def __init__(self, todo, line, marker): self.todo = todo self.line = line self.marker = marker class TodoView(PidaView): key = 'todo.list' label_text = _('TODO')