def add_mainframe_menu(menulist):
    menulist.extend([
        ('IDM_TOOL', [
            (135, 'IDM_OPTION_LANGUAGE', tr('Language'), wx.ITEM_NORMAL, None,
             ''),
        ]),
        ('IDM_OPTION_LANGUAGE', [
            (100, 'IDM_OPTION_LANGUAGE_ENGLISH', 'English', wx.ITEM_CHECK,
             'OnOptionLanguageChange', 'Change langauage.'),
        ]),
    ])


Mixin.setPlugin('mainframe', 'add_menu', add_mainframe_menu)


def beforeinit(win):
    langinifile = common.uni_work_file('lang/language.ini')
    win.language_ids = [win.IDM_OPTION_LANGUAGE_ENGLISH]
    win.language_country = ['']
    create_language_menu(win, langinifile)


Mixin.setPlugin('mainframe', 'beforeinit', beforeinit)


def create_language_menu(win, filename):
    menu = makemenu.findmenu(win.menuitems, 'IDM_OPTION_LANGUAGE')
Exemple #2
0
        (LexerClass1.CSSLexer.metaname, 'CSS|*.css',
            wx.stc.STC_LEX_CSS, 'css.stx', LexerClass1.CSSLexer),
        (LexerClass1.JSLexer.metaname, 'JavaScript|*.js',
            wx.stc.STC_LEX_CPP, 'js.stx', LexerClass1.JSLexer),
        (LexerClass1.PHPLexer.metaname, 'PHP|*.php3;*.phtml;*.php',
            wx.stc.STC_LEX_HTML, 'php.stx', LexerClass1.PHPLexer),
        (LexerClass1.ASPLexer.metaname, 'ASP|*.asp',
            wx.stc.STC_LEX_HTML, 'asp.stx', LexerClass1.ASPLexer),
        (LexerRst.RstLexer.metaname, 'reStructuredText|*.rst',
            wx.stc.STC_LEX_CONTAINER, 'rst.stx', LexerRst.RstLexer),
        (LexerClass1.LuaLexer.metaname, 'Lua|*.lua',
            wx.stc.STC_LEX_LUA, 'lua.stx', LexerClass1.LuaLexer),
        (LexerClass1.SliceLexer.metaname, 'Slice|*.ice',
            wx.stc.STC_LEX_CPP, 'slice.stx', LexerClass1.SliceLexer),
    ])
Mixin.setPlugin('lexerfactory', 'add_lexer', add_lexer)

def add_new_files(new_files):
    new_files.extend([
        ('Plain Text', LexerClass.TextLexer.metaname),
        ('C/C++', LexerClass.CLexer.metaname),
        ('HTML', LexerClass.HtmlLexer.metaname),
        ('XML', LexerClass.XMLLexer.metaname),
        ('Python', LexerClass.PythonLexer.metaname),
        ('Java', LexerClass1.JavaLexer.metaname),
        ('Ruby', LexerClass1.RubyLexer.metaname),
        ('Perl', LexerClass1.PerlLexer.metaname),
        ('CSS', LexerClass1.CSSLexer.metaname),
        ('JavaScript', LexerClass1.JSLexer.metaname),
        ('PHP', LexerClass1.PHPLexer.metaname),
        ('ASP', LexerClass1.ASPLexer.metaname),
Exemple #3
0
#   Distributed under the terms of the GPL (GNU Public License)
#
#   UliPad is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id: mIcon.py 1457 2006-08-23 02:12:12Z limodou $

import wx
from modules import Mixin
from modules import common

def init(win):
    icon = wx.EmptyIcon()
    iconfile = common.uni_work_file('ulipad.ico')
#    icon.LoadFile(iconfile, wx.BITMAP_TYPE_ICO)
    bmp = common.getpngimage(iconfile)
#    win.SetIcon(icon.CopyFromBitmap(bmp))
    win.SetIcon(wx.Icon(iconfile, wx.BITMAP_TYPE_ICO))
Mixin.setPlugin('mainframe', 'init', init)
Exemple #4
0
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id: mAutoBak.py 1897 2007-02-03 10:33:43Z limodou $

__doc__ = 'auto make bak file as open a file'

from modules import Mixin
from modules import common

def add_pref(preflist):
    preflist.extend([
        (tr('Document')+'/'+tr('Back-End'), 100, 'check', 'auto_make_bak', tr('Make file backup at opening a file'), None)
    ])
Mixin.setPlugin('preference', 'add_pref', add_pref)

def pref_init(pref):
    pref.auto_make_bak  = False
Mixin.setPlugin('preference', 'init', pref_init)

def openfile(win, filename):
    import shutil

    if filename and win.pref.auto_make_bak:
        bakfile = filename + '.bak'
        try:
            shutil.copyfile(filename, bakfile)
        except Exception, mesg:
            common.showerror(win, mesg)
Mixin.setPlugin('editor', 'openfile', openfile, Mixin.HIGH, 0)
Exemple #5
0
#
#   UliPad is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id: mFormat.py 1457 2006-08-23 02:12:12Z limodou $

import wx.stc
from modules import Mixin

def editor_init(win):
    wx.stc.EVT_STC_STYLENEEDED(win, win.GetId(), win.OnStyleNeeded)
#    wx.EVT_PAINT(win, win.OnStyleNeeded)
Mixin.setPlugin('editor', 'init', editor_init)

def OnStyleNeeded(win, event):
    lexer = getattr(win, 'lexer', None)
    if lexer:
        if lexer.syntaxtype == wx.stc.STC_LEX_CONTAINER:
            lexer.styleneeded(win, event.GetPosition())
Mixin.setMixin('editor', 'OnStyleNeeded', OnStyleNeeded)
Exemple #6
0
import wx
from modules import Mixin
from modules import common

eolmess = [tr(r"Unix mode (\n)"), tr(r"DOS/Windows mode (\r\n)"), tr(r"Mac mode (\r)")]

def beforeinit(win):
    win.lineendingsaremixed = False
    win.eolmode = win.pref.default_eol_mode
    win.eols = {0:wx.stc.STC_EOL_LF, 1:wx.stc.STC_EOL_CRLF, 2:wx.stc.STC_EOL_CR}
#    win.eolstr = {0:'Unix', 1:'Win', 2:'Mac'}
    win.eolstr = {0:r'\n', 1:r'\r\n', 2:r'\r'}
    win.eolstring = {0:'\n', 1:'\r\n', 2:'\r'}
    win.eolmess = eolmess
    win.SetEOLMode(win.eols[win.eolmode])
Mixin.setPlugin('editor', 'init', beforeinit)

def add_pref(preflist):
    preflist.extend([
        (tr('Document'), 140, 'choice', 'default_eol_mode', tr('Default line ending used in the document:'), eolmess)
    ])
Mixin.setPlugin('preference', 'add_pref', add_pref)

def pref_init(pref):
    if wx.Platform == '__WXMSW__':
        pref.default_eol_mode = 1
    else:
        pref.default_eol_mode = 0
Mixin.setPlugin('preference', 'init', pref_init)

def add_mainframe_menu(menulist):
Exemple #7
0
        if dynamic_menu(editor):
            menus.extend([(None, #parent menu id
                [
                    (30, 'IDPM_WEB2PY_PROJECT', tr('&Web2py'), wx.ITEM_NORMAL, '', ''),
                    (35, 'IDPM_WEB2PY_PROJECT_CONTROLLERS_VIEW', dynamic_menu(editor), wx.ITEM_NORMAL, 'OnWeb2pyProjectFunc', tr('Create a view or open view.')),
                    (38, 'IDPM_WEB2PY_PROJECT_CONTROLLERS_WEB', dynamic_menu(editor, 'web'), wx.ITEM_NORMAL, 'OnWeb2pyProjectFunc', tr('visit web site')),
                    
                    (40, '', '-', wx.ITEM_SEPARATOR, None, ''),
                ]),
                ('IDPM_WEB2PY_PROJECT',
                [
##                    (100, 'IDPM_WEB2PY_PROJECT_CONTROLLERS_VIEW', dynamic_menu(editor), wx.ITEM_NORMAL, 'OnWeb2pyProjectFunc', tr('Create a view or open view.')),
                    (110, '', '-', wx.ITEM_SEPARATOR, None, ''),
                ]),
            ])
Mixin.setPlugin('editor', 'other_popup_menu', other_popup_menu)

def OnWeb2pyProjectFunc(win, event):
    _id = event.GetId()
    
    try:
        if _id == win.IDPM_WEB2PY_PROJECT_CONTROLLERS_VIEW:
            OnWeb2pyProjectControllersView(win)
        elif  _id == win.IDPM_WEB2PY_PROJECT_CONTROLLERS_WEB:
            
            OnWeb2pyProjectControllersWeb(win)
    except:
        error.traceback()
        common.showerror(win, tr("There is some wrong as executing the menu."))
Mixin.setMixin('editor', 'OnWeb2pyProjectFunc', OnWeb2pyProjectFunc)
Exemple #8
0
from modules import Mixin
import LexerBase
from modules import Globals


def add_pref(preflist):
    names = LexerBase.color_theme.keys()
    names.sort()
    preflist.extend([
        (tr('General'), 131, 'choice', 'default_color_theme',
         tr('Default color theme:'), names),
    ])


Mixin.setPlugin('preference', 'add_pref', add_pref)


def pref_init(pref):
    pref.default_color_theme = 'Blue'


Mixin.setPlugin('preference', 'init', pref_init)


def set_default_style(lexer):
    lexer.set_color_theme(Globals.pref.default_color_theme)


Mixin.setPlugin('lexerbase', 'set_default_style', set_default_style)
Exemple #9
0
                (130, 'IDPM_DJANGO_DOT', tr('Create &Dot'), wx.ITEM_NORMAL,
                 'OnDjangoFunc', ''),
            ]),
        ])
        dir = common.getCurrentDir(dirwin.get_node_filename(item))
        if os.path.isdir(dir) and os.path.exists(
                os.path.join(os.path.dirname(dir), '_project')):
            menus.extend([
                (None, [
                    (520, 'IDPM_DJANGO_INSTALLAPP', tr('Install Application'),
                     wx.ITEM_NORMAL, 'OnDjangoFunc', ''),
                ]),
            ])


Mixin.setPlugin('dirbrowser', 'other_popup_menu', other_popup_menu)

project_names = ['django']
Mixin.setMixin('dirbrowser', 'project_names', project_names)


def set_project(ini, projectnames):
    if 'django' in projectnames:
        common.set_acp_highlight(ini, '.html', ['html.acp', 'django_html.acp'],
                                 'djangotmp')


Mixin.setPlugin('dirbrowser', 'set_project', set_project)


def remove_project(ini, projectnames):
Exemple #10
0
        if mid in editoraccellist:
            keys, func = editoraccellist[mid]
            del editoraccellist[mid]
            accellist[mid] = (hotkey, func)
        elif mid in accellist:
            keys, func = accellist[mid]
            accellist[mid] = (hotkey, func)

    #mid can be a editor menu ID or a editor function name
    #which should only has one parameter
    for mid, hotkey in ini.editor_hotkey.items():
        _id, _t = keylist.get(hotkey, ('', ''))
        if _id:
            if _t == 'main':
                keys, func = accellist[_id]
                accellist[_id] = ('', func)
            else:
                keys, func = editoraccellist[_id]
                editoraccellist[_id] = ('', func)

        if accellist.has_key(mid):
            keys, func = accellist[mid]
            del accellist[mid]
            editoraccellist[mid] = (hotkey, func)
        elif editoraccellist.has_key(mid):
            keys, func = editoraccellist[mid]
            editoraccellist[mid] = (hotkey, func)


Mixin.setPlugin('mainframe', 'init_accelerator', init_accelerator)
Exemple #11
0
                (137, 'IDM_TOOL_SEARCHCMDS', tr('Commands'), wx.ITEM_NORMAL,
                 '', ''),
            ]),
        ('IDM_TOOL_SEARCHCMDS', [
            (100, 'IDM_TOOL_SEARCHCMDS_SEARCH',
             tr('Searching...') + '\tCtrl+K', wx.ITEM_NORMAL,
             'OnToolSearchCMDS', tr('Searches commands.')),
            (110, 'IDM_TOOL_SEARCHCMDS_IMPACT_MODE',
             tr('Switch Impact Mode') + '\tCtrl+Shift+K', wx.ITEM_CHECK,
             'OnToolSearchCMDSImpactMode',
             tr('Switches commands searching impact mode.')),
        ]),
    ])


Mixin.setPlugin('mainframe', 'add_menu', add_mainframe_menu)


def mainframe_init(win):
    win.command_mode = False


Mixin.setPlugin('mainframe', 'init', mainframe_init)

#def on_set_focus(win, event):
#    win.on_focus = True
#Mixin.setPlugin('editor', 'on_set_focus', on_set_focus)


def on_kill_focus(win, event):
    return Globals.mainframe.command_mode is True
    item = dirwin.tree.GetSelection()
    if not item.IsOk(): return
    if 'web2py' in projectname:
        dir = common.getCurrentDir(dirwin.get_node_filename(item))
        basedir = os.path.basename(os.path.dirname(dir))
        if os.path.isdir(dir) and basedir == 'applications':
            menus.extend([
                (None, [
                    (500, '', '-', wx.ITEM_SEPARATOR, None, ''),
                    (520, 'IDPM_WEB2PY_SHELL', tr('Start web2py Shell'),
                     wx.ITEM_NORMAL, 'OnWeb2pyShell', ''),
                ]),
            ])


Mixin.setPlugin('dirbrowser', 'other_popup_menu', other_popup_menu)

project_names = ['web2py']
Mixin.setMixin('dirbrowser', 'project_names', project_names)


def set_project(ini, projectnames):
    if 'web2py' in projectnames:
        common.set_acp_highlight(ini, '.html', ['html.acp', 'web2py_html.acp'],
                                 'web2pyview')
        common.set_acp_highlight(ini, '.py', ['web2py_py.acp'], 'python')


Mixin.setPlugin('dirbrowser', 'set_project', set_project)

Exemple #13
0
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id$

import re
from modules import Mixin

r_lang = re.compile('^#!\s*/usr/bin/env\s+(\w+)')


def guess_language(win, language):
    l = win.GetLine(0).lower()
    lang = language
    if not lang and l[:2] == "#!":
        b = r_lang.search(l)
        if b:
            lang = b.groups()[0]

    return lang


Mixin.setPlugin('editor', 'guess_lang', guess_language)
Exemple #14
0
    __mixinname__ = 'restfiletype'
    menulist = [
        (None, [
            (890, 'IDM_REST', 'ReST', wx.ITEM_NORMAL, None, ''),
        ]),
    ]
    toollist = []  #your should not use supperclass's var
    toolbaritems = {}


def add_filetypes(filetypes):
    filetypes.extend([('rst', RestFiletype)])


Mixin.setPlugin('changefiletype', 'add_filetypes', add_filetypes)


def add_rest_menu(menulist):
    menulist.extend([
        (
            'IDM_REST',  #parent menu id
            [
                (100, 'IDM_REST_VIEW_IN_LEFT',
                 tr('View HTML Result In Left Pane'),
                 wx.ITEM_NORMAL, 'OnRestViewHtmlInLeft',
                 tr('Views HTML result in left pane.')),
                (110, 'IDM_REST_VIEW_IN_BOTTOM',
                 tr('View HTML Result In Bottom Pane'), wx.ITEM_NORMAL,
                 'OnRestViewHtmlInBottom',
                 tr('Views HTML result in bottom pane.')),
Exemple #15
0
    wx.EVT_UPDATE_UI(win, win.GetId(),  win.RunCheck)

    win.MAX_PROMPT_COMMANDS = 25

    win.process = None
    win.pid = -1

    win.CommandArray = []
    win.CommandArrayPos = -1

    win.editpoint = 0
    win.writeposition = 0

    win.commandlen = 0
    win.firstread = 0
Mixin.setPlugin('dospromptwindow', 'init', init)

def RunDosCommand(win, command, guiflag=False, redirect=True):
    """replace $file = current document filename"""
    if redirect:
        win.createDosWindow()

        win.panel.showPage(tr('Dos'))

        win.dosprompt.SetText('')
        win.dosprompt.editpoint = 0
        win.dosprompt.writeposition = 0
        try:
            win.dosprompt.process = wx.Process(win)
            win.dosprompt.process.Redirect()
            if guiflag:

def other_popup_menu(editor, projectname, menus):
    if editor.languagename == 'python':
        menus.extend([
            (
                None,  #parent menu id
                [
                    (9, 'IDPM_PYTHON_EPYDOC',
                     tr('Create Comment for Function'), wx.ITEM_NORMAL,
                     'OnPythonEPyDoc', 'Creates comment for a function.'),
                ]),
        ])


Mixin.setPlugin('editor', 'other_popup_menu', other_popup_menu)

re_func = re.compile('^(\s*)def\s+[\w\d_]+\((.*?)\):')
comment_template = """

@author: %(username)s  

%(parameters)s
@return:
@rtype: 
"""


def OnPythonEPyDoc(win, event=None):
    def output(win, indent, parameters, pos):
        t = (indent / win.GetTabWidth() + 1) * win.getIndentChar()
Exemple #17
0
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id$

import wx
from modules import Mixin
from modules import Globals

def afterinit(win):
    win.command_starting = False
    win.concurrentwindow = None
Mixin.setPlugin('mainframe', 'afterinit', afterinit)

def on_kill_focus(win, event):
    main = Globals.mainframe
    if main.concurrentwindow and main.concurrentwindow.has_document(win):
        return Globals.mainframe.command_starting is True
Mixin.setPlugin('editor', 'on_kill_focus', on_kill_focus)

def on_start(concurrent, side):
    win = Globals.mainframe
    win.command_starting = True
    win.concurrentwindow = concurrent
Mixin.setPlugin('concurrent', 'start', on_start)

def on_stop(concurrent, side):
    win = Globals.mainframe
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id: mChangeFileType.py 1457 2006-08-23 02:12:12Z limodou $

__doc__ = 'Process changing file type event'

from modules import Mixin


def on_document_lang_enter(win, document):
    win.mainframe.changefiletype.enter(win.mainframe, document)


Mixin.setPlugin('editctrl', 'on_document_lang_enter', on_document_lang_enter)


def on_document_lang_leave(win, filename, languagename):
    win.mainframe.changefiletype.leave(win.mainframe, filename, languagename)


Mixin.setPlugin('editctrl', 'on_document_lang_leave', on_document_lang_leave)


def afterinit(win):
    import ChangeFileType

    win.changefiletype = ChangeFileType.ChangeFileType()

Exemple #19
0
#   Programmer: limodou
#   E-mail:     [email protected]
#
#   Copyleft 2006 limodou
#
#   Distributed under the terms of the GPL (GNU Public License)
#
#   UliPad is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id$

from modules import Mixin

def add_pref(preflist):
    preflist.extend([
        ('Config.ini', 100, 'check', '_config_default_debug', tr('Enable debug mode'), None)
    ])
Mixin.setPlugin('preference', 'add_pref', add_pref)
import os
import glob
from modules import Mixin
from modules.Debug import error
from modules import Globals
from modules import common
from modules import dict4ini

CALLTIP_AUTOCOMPLETE = 2


def mainframe_init(win):
    win.input_assistant = None


Mixin.setPlugin('mainframe', 'init', mainframe_init)


def editor_init(win):
    win.AutoCompSetIgnoreCase(True)
    win.AutoCompStops(' .,;:()[]{}\'"\\<>%^&+-=*/|`')
    win.AutoCompSetAutoHide(True)
    win.AutoCompSetCancelAtStart(False)

    #    win.inputassistant_obj = None
    win.replace_strings = None
    win.word_len = 0
    win.custom_assistant = []
    win.function_parameter = []
    win.calltip_stack = {}  # collecting nested calltip's text and pos.
    win.syntax_info = None
Exemple #21
0
    wx.EVT_KEY_DOWN(win, win.OnKeyDown)
    wx.EVT_KEY_UP(win, win.OnKeyUp)
    wx.EVT_UPDATE_UI(win, win.GetId(),  win.RunCheck)

    win.MAX_PROMPT_COMMANDS = 25

    win.process = None
    win.pid = -1

    win.CommandArray = []
    win.CommandArrayPos = -1

    win.editpoint = 0
    win.writeposition = 0
    win.callback = None
Mixin.setPlugin('messagewindow', 'init', message_init)

#patameters:
#   (redirect=True, hide=False, input_decorator=None, callback=None)
def RunCommand(win, command, redirect=True, hide=False, input_decorator=None,
        callback=None):
    """replace $file = current document filename"""
    global input_appendtext

    #test if there is already a running process
    if hasattr(win, 'messagewindow') and win.messagewindow and win.messagewindow.process:
        common.showmessage(win, tr("The last process didn't stop yet. Please stop it and try again."))
        return
    if input_decorator:
        input_appendtext = input_decorator(appendtext)
    else:
Exemple #22
0
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id$

import wx
from modules import Mixin
import editor_ext
import dirbrowser_ext
import DjangoTMPLexer

def add_lexer(lexer):
    lexer.extend([
        (DjangoTMPLexer.DjangoTmpLexer.metaname, 'Django Template|*.dmp',
            wx.stc.STC_LEX_CONTAINER, 'djangotmp.stx', DjangoTMPLexer.DjangoTmpLexer),
    ])
Mixin.setPlugin('lexerfactory', 'add_lexer', add_lexer)

def add_new_files(new_files):
    new_files.extend([
        ('Django Template', DjangoTMPLexer.DjangoTmpLexer.metaname),
    ])
Mixin.setPlugin('mainframe', 'add_new_files', add_new_files)

Exemple #23
0
from modules import Mixin
from mixins import FiletypeBase

class FortranFiletype(FiletypeBase.FiletypeBase):

    __mixinname__ = 'fortranfiletype'
    menulist = [ (None,
        [
            (890, 'IDM_FORTRAN', 'Fortran', wx.ITEM_NORMAL, None, ''),
        ]),
    ]
    toollist = []               #your should not use supperclass's var
    toolbaritems= {}

def add_filetypes(filetypes):
    filetypes.extend([('fortran', FortranFiletype)])
Mixin.setPlugin('changefiletype', 'add_filetypes', add_filetypes)

def add_html_menu(menulist):
    menulist.extend([('IDM_FORTRAN', #parent menu id
            [
                (100, 'IDM_FORTRAN_TEST', tr('This is a test menu'), wx.ITEM_NORMAL, 'OnFortranTest', tr('This is a test.')),
            ]),
    ])
Mixin.setPlugin('fortranfiletype', 'add_menu', add_html_menu)

def OnFortranTest(win, event):
    print 'fortran menu test'
Mixin.setMixin('mainframe', 'OnFortranTest', OnFortranTest)

            (100, 'IDM_EDIT_FORMAT_CHOP', tr('Trim Trailing Whitespace'), wx.ITEM_NORMAL, 'OnEditFormatChop', tr('Trims the trailing whitespace.')),
            (110, 'IDM_EDIT_FORMAT_SPACETOTAB', tr('Leading Spaces To Tabs'), wx.ITEM_NORMAL, 'OnEditFormatSpaceToTab', tr('Converts leading spaces to tabs.')),
            (120, 'IDM_EDIT_FORMAT_TABTOSPACE', tr('Leading Tabs To Spaces'), wx.ITEM_NORMAL, 'OnEditFormatTabToSpace', tr('Converts leading tabs to spaces.')),
            (125, 'IDM_EDIT_FORMAT_ALLTABTOSPACE', tr('All Tabs To Spaces'), wx.ITEM_NORMAL, 'OnEditFormatAllTabToSpace', tr('Converts all tabs to spaces.')),
            (130, '', '-', wx.ITEM_SEPARATOR, None, ''),
            (140, 'IDM_EDIT_FORMAT_INDENT', tr('Increase Indent'), wx.ITEM_NORMAL, 'OnEditFormatIndent', tr('Increases the indentation of current line or selected block.')),
            (150, 'IDM_EDIT_FORMAT_UNINDENT', tr('Decrease Indent'), wx.ITEM_NORMAL, 'OnEditFormatUnindent', tr('Decreases the indentation of current line or selected block.')),
            (160, '', '-', wx.ITEM_SEPARATOR, None, ''),
            (170, 'IDM_EDIT_FORMAT_COMMENT', tr('Line Comment...') + '\tE=Ctrl+/', wx.ITEM_NORMAL, 'OnEditFormatComment', tr('Inserts comment sign at the beginning of line.')),
            (180, 'IDM_EDIT_FORMAT_UNCOMMENT', tr('Line Uncomment...') + '\tE=Ctrl+\\', wx.ITEM_NORMAL, 'OnEditFormatUncomment', tr('Removes comment sign from the beginning of line.')),
            (190, '', '-', wx.ITEM_SEPARATOR, None, ''),
            (200, 'IDM_EDIT_FORMAT_QUOTE', tr('Text Quote...') + '\tE=Ctrl+\'', wx.ITEM_NORMAL, 'OnEditFormatQuote', tr('Quotes selected text.')),
            (210, 'IDM_EDIT_FORMAT_UNQUOTE', tr('Text Unquote...') + '\tE=Ctrl+Shift+\'', wx.ITEM_NORMAL, 'OnEditFormatUnquote', tr('Unquotes selected text.')),
        ]),
    ])
Mixin.setPlugin('mainframe', 'add_menu', add_mainframe_menu)

def add_editor_menu(popmenulist):
    popmenulist.extend([ (None, #parent menu id
        [
            (220, 'IDPM_FORMAT', tr('Format'), wx.ITEM_NORMAL, None, ''),
        ]),
        ('IDPM_FORMAT',
        [
            (100, 'IDPM_FORMAT_CHOP', tr('Trim Trailing Whitespace'), wx.ITEM_NORMAL, 'OnFormatChop', tr('Trims the trailing whitespace.')),
            (110, 'IDPM_FORMAT_SPACETOTAB', tr('Convert Leading Spaces To Tabs'), wx.ITEM_NORMAL, 'OnFormatSpaceToTab', tr('Converts leading spaces to tabs.')),
            (120, 'IDPM_FORMAT_TABTOSPACE', tr('Convert Leading Tabs To Spaces'), wx.ITEM_NORMAL, 'OnFormatTabToSpace', tr('Converts leading tabs to spaces.')),
            (125, 'IDPM_FORMAT_ALLTABTOSPACE', tr('Convert All Tabs To Spaces'), wx.ITEM_NORMAL, 'OnFormatAllTabToSpace', tr('Converts all tabs to spaces.')),
            (130, '', '-', wx.ITEM_SEPARATOR, None, ''),
            (140, 'IDPM_FORMAT_INDENT', tr('Increase Indent'), wx.ITEM_NORMAL, 'OnFormatIndent', tr('Increases the indentation of current line or selected block.')),
            (150, 'IDPM_FORMAT_UNINDENT', tr('Decrease Indent'), wx.ITEM_NORMAL, 'OnFormatUnindent', tr('Decreases the indentation of current line or selected block.')),
Exemple #25
0
]
Mixin.setMixin('mainframe', 'toollist', toollist)

_wizard_pagename = tr('Wizard')

#order, IDname, imagefile, short text, long text, func
toolbaritems = {
        'wizard':(wx.ITEM_CHECK, 'IDM_WINDOW_WIZARD', images.getWizardBitmap(), _wizard_pagename, tr('Opens wizard window.'), 'OnWindowWizard'),
}
Mixin.setMixin('mainframe', 'toolbaritems', toolbaritems)

def on_mainframe_updateui(win, event):
    eid = event.GetId()
    if eid == win.IDM_WINDOW_WIZARD:
        event.Check(bool(win.panel.getPage(_wizard_pagename)) and win.panel.LeftIsVisible)
Mixin.setPlugin('mainframe', 'on_update_ui', on_mainframe_updateui)

def afterinit(win):
    wx.EVT_UPDATE_UI(win, win.IDM_WINDOW_WIZARD, win.OnUpdateUI)
Mixin.setPlugin('mainframe', 'afterinit', afterinit)

def on_notebook_updateui(win, event):
    eid = event.GetId()
    if eid == win.IDPM_WIZARDWINDOW:
        event.Check(bool(win.panel.getPage(_wizard_pagename)) and win.panel.LeftIsVisible)
Mixin.setPlugin('notebook', 'on_update_ui', on_notebook_updateui)

def init(win):
    wx.EVT_UPDATE_UI(win, win.IDPM_WIZARDWINDOW, win.OnUpdateUI)
Mixin.setPlugin('notebook', 'init', init)
Exemple #26
0
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id: mShowLocale.py 1566 2006-10-09 04:44:08Z limodou $

__doc__ = 'show document locale in statusbar'

from modules import Mixin
from modules import common


def on_document_enter(win, document):
    if document.edittype == 'edit':
        common.set_encoding(win.document.locale)


Mixin.setPlugin('editctrl', 'on_document_enter', on_document_enter)


def fileopentext(win, stext):
    common.set_encoding(win.locale)


Mixin.setPlugin('editor', 'openfiletext', fileopentext)


def savefiletext(win, stext):
    common.set_encoding(win.locale)


Mixin.setPlugin('editor', 'savefiletext', savefiletext)
Exemple #27
0
#   $Id: mFtp.py 2120 2007-07-11 02:56:11Z limodou $

__doc__ = 'ftp manage'

import wx
from modules import Mixin
from modules.Debug import error
from modules import common

def add_mainframe_menu(menulist):
    menulist.extend([ ('IDM_WINDOW',
        [
            (160, 'IDM_WINDOW_FTP', tr('FTP Window'), wx.ITEM_CHECK, 'OnWindowFtp', tr('Shows the FTP pane.')),
        ]),
    ])
Mixin.setPlugin('mainframe', 'add_menu', add_mainframe_menu)

def afterinit(win):
    win.ftp_imagelist = {
    'close':            'images/folderclose.gif',
    'document':         'images/file.gif',
    'parentfold':       'images/parentfold.gif',
}
    win.ftp_resfile = common.uni_work_file('resources/ftpmanagedialog.xrc')
    win.ftp = None
Mixin.setPlugin('mainframe', 'afterinit', afterinit)

def on_mainframe_updateui(win, event):
    eid = event.GetId()
    if eid == win.IDM_WINDOW_FTP:
        event.Check(bool(win.panel.getPage('FTP')) and win.panel.BottomIsVisible)
Exemple #28
0
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id: mMainFrame.py 1609 2006-10-15 09:27:37Z limodou $

from modules import Mixin
from modules import Globals


def getmainframe(app, filenames):
    from MainFrame import MainFrame
    Globals.starting = True

    app.mainframe = frame = MainFrame(app, filenames)

    frame.workpath = app.workpath
    frame.userpath = app.userpath
    frame.afterinit()
    frame.editctrl.openPage()
    Globals.starting = False
    return frame


Mixin.setPlugin('app', 'getmainframe', getmainframe)
Exemple #29
0
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id: mClassBrowser.py 154 2005-11-07 04:48:15Z limodou $

import wx
import os
from modules import common, Mixin

def mainframe_init(win):
    win.memo_win = None
Mixin.setPlugin('mainframe', 'init', mainframe_init)

def pref_init(pref):
    pref.easy_memo_lastpos = 0
Mixin.setPlugin('preference', 'init', pref_init)

def add_mainframe_menu(menulist):
    menulist.extend([('IDM_TOOL', #parent menu id
        [
            (140, '-', '', wx.ITEM_SEPARATOR, '', ''),
            (150, 'IDM_TOOL_MEMO', tr('Easy Memo') + u'\tF12', wx.ITEM_CHECK, 'OnToolMemo', tr('Shows the window Easy Memo for writing notes.')),
        ]),
    ])
Mixin.setPlugin('mainframe', 'add_menu', add_mainframe_menu)

def OnToolMemo(win, event):
Exemple #30
0
from modules import Globals

def add_mainframe_menu(menulist):
    menulist.extend([ ('IDM_SEARCH',
        [
            (176, 'IDM_SEARCH_SMART_NAV', tr('Smart Navigation'), wx.ITEM_NORMAL, '', ''),
        ]),
        ('IDM_SEARCH_SMART_NAV',
            [
                (100, 'IDM_SEARCH_NAV_PREV', tr('Go To Previous File'), wx.ITEM_NORMAL, 'OnSmartNavPrev', tr('Goes to previous file.')),
                (110, 'IDM_SEARCH_NAV_NEXT', tr('Go To Next File'), wx.ITEM_NORMAL, 'OnSmartNavNext', tr('Goes to next file.')),
                (120, 'IDM_SEARCH_NAV_CLEAR', tr('Clear Filenames'), wx.ITEM_NORMAL, 'OnSmartNavClear', tr('Clears buffered filenames.')),
            ]),
        
    ])
Mixin.setPlugin('mainframe', 'add_menu', add_mainframe_menu)

def add_tool_list(toollist, toolbaritems):
    toollist.extend([
        (235, 'smartprev'),
        (236, 'smartnext'),
    ])

    #order, IDname, imagefile, short text, long text, func
    toolbaritems.update({
        'smartprev':(10, create_prev),
        'smartnext':(10, create_next),
    })
Mixin.setPlugin('mainframe', 'add_tool_list', add_tool_list)

def create_prev(win, toolbar):
Exemple #31
0
#   $Id: mFormat.py 1457 2006-08-23 02:12:12Z limodou $

import os
import wx.stc
from modules import Mixin
from modules import common
from modules import dict4ini
from modules.Debug import error

def add_mainframe_menu(menulist):
    menulist.extend([ ('IDM_SEARCH',
        [
            (175, 'IDM_SEARCH_GOTO_DEF', tr('Jump To The Definition')+'\tE=Ctrl+I', wx.ITEM_NORMAL, 'OnSearchJumpDef', tr('Jumps to head of line containing variable or function definition.')),
        ]),
    ])
Mixin.setPlugin('mainframe', 'add_menu', add_mainframe_menu)

def add_editor_menu(popmenulist):
    popmenulist.extend([ (None, #parent menu id
        [
            (10, 'IDPM_GOTO_DEF', tr('Jump To The Definition')+'\tCtrl+I', wx.ITEM_NORMAL, 'OnJumpDef', tr('Jumps to definition.')),
        ]),
    ])
Mixin.setPlugin('editor', 'add_menu', add_editor_menu)

_mlist = {}
def OnSearchJumpDef(win, event):
    global _mlist
    
    word = getword(win)
    from modules import ctags
Exemple #32
0
             tr('Changes the selected text to upper case.')),
            (200, 'IDM_EDIT_CASE_LOWER_CASE',
             tr('Lowercase') + '\tE=Ctrl+Shift+U', wx.ITEM_NORMAL,
             'OnEditCaseLowerCase',
             tr('Changes the selected text to lower case.')),
            (300, 'IDM_EDIT_CASE_INVERT_CASE', tr('Invert Case'),
             wx.ITEM_NORMAL, 'OnEditCaseInvertCase',
             tr('Inverts the case of the selected text.')),
            (400, 'IDM_EDIT_CASE_CAPITALIZE', tr('Capitalize'), wx.ITEM_NORMAL,
             'OnEditCaseCapitalize',
             tr('Capitalizes all words of the selected text.')),
        ]),
    ])


Mixin.setPlugin('mainframe', 'add_menu', add_mainframe_menu)


def add_editor_menu(popmenulist):
    popmenulist.extend([
        (
            None,  #parent menu id
            [
                (230, 'IDPM_CASE', tr('Case'), wx.ITEM_NORMAL, None, ''),
            ]),
        ('IDPM_CASE', [
            (100, 'IDPM_CASE_UPPER_CASE', tr('Uppercase') + '\tCtrl+U',
             wx.ITEM_NORMAL, 'OnCaseUpperCase',
             tr('Changes the selected text to upper case.')),
            (200, 'IDPM_CASE_LOWER_CASE', tr('Lowercase') + '\tCtrl+Shift+U',
             wx.ITEM_NORMAL, 'OnCaseLowerCase',
Exemple #33
0
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id: mPosition.py 1566 2006-10-09 04:44:08Z limodou $

import wx
from modules import Mixin

def on_key_up(win, event):
    if win.edittype == 'edit':
        win.mainframe.SetStatusText(tr("Line: %d") % (win.GetCurrentLine()+1), 1)
        win.mainframe.SetStatusText(tr("Column: %d") % (win.GetColumn(win.GetCurrentPos())+1), 2)
#        win.mainframe.SetStatusText(tr("Selected: %d") % len(win.GetSelectedText()), 3)
Mixin.setPlugin('editor', 'on_key_up', on_key_up)

def on_mouse_up(win, event):
    if win.edittype == 'edit':
        win.mainframe.SetStatusText(tr("Line: %d") % (win.GetCurrentLine()+1), 1)
        win.mainframe.SetStatusText(tr("Column: %d") % (win.GetColumn(win.GetCurrentPos())+1), 2)
#        win.mainframe.SetStatusText(tr("Selected: %d") % len(win.GetSelectedText()), 3)
Mixin.setPlugin('editor', 'on_mouse_up', on_mouse_up)

def on_document_enter(win, document):
    if document.edittype == 'edit':
        win.mainframe.SetStatusText(tr("Line: %d") % (document.GetCurrentLine()+1), 1)
        win.mainframe.SetStatusText(tr("Column: %d") % (document.GetColumn(document.GetCurrentPos())+1), 2)
#        win.mainframe.SetStatusText(tr("Selected: %d") % len(document.GetSelectedText()), 3)
Mixin.setPlugin('editctrl', 'on_document_enter', on_document_enter)
def on_editor_updateui(win, event):
    # check for matching braces
    braceAtCaret = -1
    braceOpposite = -1
    charBefore = None
    caretPos = win.GetCurrentPos()
    if caretPos > 0:
        charBefore = win.GetCharAt(caretPos - 1)
        styleBefore = win.GetStyleAt(caretPos - 1)

    # check before
    if charBefore and chr(charBefore) in "[]{}()": # and styleBefore == wx.stc.STC_P_OPERATOR:
        braceAtCaret = caretPos - 1

    # check after
    if braceAtCaret < 0:
        charAfter = win.GetCharAt(caretPos)
        styleAfter = win.GetStyleAt(caretPos)
        if charAfter and chr(charAfter) in "[]{}()": # and styleAfter == wx.stc.STC_P_OPERATOR:
            braceAtCaret = caretPos

    if braceAtCaret >= 0:
        braceOpposite = win.BraceMatch(braceAtCaret)

    if braceAtCaret != -1  and braceOpposite == -1:
        win.BraceBadLight(braceAtCaret)
    else:
        win.BraceHighlight(braceAtCaret, braceOpposite)
Mixin.setPlugin('editor', 'on_update_ui', on_editor_updateui)
#   $Id$

import wx
import re
from modules import Mixin
from modules import common
from modules import Globals

def other_popup_menu(win, menus):
    menus.extend([(None, #parent menu id
        [
            (190, '', '-', wx.ITEM_SEPARATOR, None, ''),
            (200, 'IDPM_GOTO', tr('Goto error line'), wx.ITEM_NORMAL, 'OnGoto', tr('Goto the line that occurs the error.')),
        ]),
    ])
Mixin.setPlugin('messagewindow', 'other_popup_menu', other_popup_menu)

r = re.compile('File\s+"(.*?)",\s+line\s+(\d+)')
def OnGoto(win, event):
    line = win.GetCurLine()[0]
    b = r.search(common.encode_string(line, common.defaultfilesystemencoding))
    if b:
        filename, lineno = b.groups()
        Globals.mainframe.editctrl.new(filename)
        wx.CallAfter(Globals.mainframe.document.goto, int(lineno))
Mixin.setMixin('messagewindow', 'OnGoto', OnGoto)

def messagewindow_init(win):
    wx.EVT_LEFT_DCLICK(win, win.OnGoto)
Mixin.setPlugin('messagewindow', 'init', messagewindow_init)
Exemple #36
0
def pref_init(pref):
    s = check_python()
    pref.python_interpreter = s
    if len(s) == 1:
        pref.default_interpreter = s[0][0]
    else:
        pref.default_interpreter = 'noexist'
    pref.python_show_args = False
    pref.python_save_before_run = False
    pref.python_default_paramters = {}
    for i in s:
        pref.python_default_paramters[i[0]] = '-u'


Mixin.setPlugin('preference', 'init', pref_init)


def OnSetPythonInterpreter(win, event):
    from InterpreterDialog import InterpreterDialog
    dlg = InterpreterDialog(win, win.pref)
    dlg.ShowModal()


Mixin.setMixin('prefdialog', 'OnSetPythonInterpreter', OnSetPythonInterpreter)


def add_pref(preflist):
    preflist.extend([
        ('Python', 150, 'button', 'python_interpreter',
         tr('Setup Python interpreter...'), 'OnSetPythonInterpreter'),
Exemple #37
0
import images
from modules import Globals
import os

popmenulist = [ ('IDPM_ADD',
    [
        (100, 'IDPM_ADD_RSSREADER', tr('RSS Reader'), wx.ITEM_NORMAL, 'OnAddRssReader', ''),
    ]),
]
Mixin.setMixin('sharewin', 'popmenulist', popmenulist)

def add_process_class(type, win, proc_dict):
    if type == 'rss':
        from RssReader import RssReader
        proc_dict['rss'] = RssReader(win)
Mixin.setPlugin('sharewin', 'add_process_class', add_process_class)

def add_images(images):
    s = [
        ('RSS_ROOT_IMAGE', 'rss.gif'),
        ('RSS_CATEGORY_IMAGE', 'category.gif'),
        ('RSS_FEED_IMAGE', 'feed.gif'),
        ('RSS_RUN1', 'run1.gif'),
        ('RSS_RUN2', 'run2.gif'),
        ('RSS_RUN3', 'run3.gif'),
        ('RSS_ERROR', 'error.gif'),
        ]
    for name, f in s:
        images[name] = os.path.join(Globals.workpath, 'plugins/rssreader/%s' % f)
Mixin.setPlugin('sharewin', 'add_images', add_images)
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id: mFolder.py 1897 2007-02-03 10:33:43Z limodou $

import wx
import wx.stc
from modules import Mixin


def pref_init(pref):
    pref.use_folder = True


Mixin.setPlugin('preference', 'init', pref_init)


def add_pref(preflist):
    preflist.extend([
        (tr('Document'), 130, 'check', 'use_folder',
         tr('Show code folding margin'), None),
    ])


Mixin.setPlugin('preference', 'add_pref', add_pref)


def savepreference(mainframe, pref):
    for document in mainframe.editctrl.getDocuments():
        if document.enablefolder:
Exemple #39
0
from modules.Debug import error

class RestFiletype(FiletypeBase.FiletypeBase):

    __mixinname__ = 'restfiletype'
    menulist = [ (None,
        [
            (890, 'IDM_REST', 'ReST', wx.ITEM_NORMAL, None, ''),
        ]),
    ]
    toollist = []               #your should not use supperclass's var
    toolbaritems= {}

def add_filetypes(filetypes):
    filetypes.extend([('rst', RestFiletype)])
Mixin.setPlugin('changefiletype', 'add_filetypes', add_filetypes)

def add_rest_menu(menulist):
    menulist.extend([('IDM_REST', #parent menu id
            [
                (100, 'IDM_REST_VIEW_IN_LEFT', tr('View HTML Result In Left Pane'), wx.ITEM_NORMAL, 'OnRestViewHtmlInLeft', tr('Views HTML result in left pane.')),
                (110, 'IDM_REST_VIEW_IN_BOTTOM', tr('View HTML Result In Bottom Pane'), wx.ITEM_NORMAL, 'OnRestViewHtmlInBottom', tr('Views HTML result in bottom pane.')),
            ]),
    ])
Mixin.setPlugin('restfiletype', 'add_menu', add_rest_menu)

def OnRestViewHtmlInLeft(win, event):
    dispname = win.createRestHtmlViewWindow('left', Globals.mainframe.editctrl.getCurDoc())
    if dispname:
        win.panel.showPage(dispname)
Mixin.setMixin('mainframe', 'OnRestViewHtmlInLeft', OnRestViewHtmlInLeft)
Exemple #40
0
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id$

import wx
from modules import Mixin
from modules import Globals


def afterinit(win):
    win.command_starting = False
    win.concurrentwindow = None


Mixin.setPlugin('mainframe', 'afterinit', afterinit)


def on_kill_focus(win, event):
    main = Globals.mainframe
    if main.concurrentwindow and main.concurrentwindow.has_document(win):
        return Globals.mainframe.command_starting is True


Mixin.setPlugin('editor', 'on_kill_focus', on_kill_focus)


def on_start(concurrent, side):
    win = Globals.mainframe
    win.command_starting = True
    win.concurrentwindow = concurrent
Exemple #41
0
from modules import Globals

def other_popup_menu(dirwin, projectname, menus):
    item = dirwin.tree.GetSelection()
    if not item.IsOk(): return
    if 'web2py' in projectname:
        dir = common.getCurrentDir(dirwin.get_node_filename(item))
        basedir = os.path.basename(os.path.dirname(dir))
        if os.path.isdir(dir) and basedir == 'applications':
            menus.extend([ (None,
            [
                (500, '', '-', wx.ITEM_SEPARATOR, None, ''),
                (520, 'IDPM_WEB2PY_SHELL', tr('Start web2py Shell'), wx.ITEM_NORMAL, 'OnWeb2pyShell', ''),
            ]),
        ])
Mixin.setPlugin('dirbrowser', 'other_popup_menu', other_popup_menu)

project_names = ['web2py']
Mixin.setMixin('dirbrowser', 'project_names', project_names)

def set_project(ini, projectnames):
    if 'web2py' in projectnames:
        common.set_acp_highlight(ini, '.html', ['html.acp', 'web2py_html.acp'], 'web2pyview')
        common.set_acp_highlight(ini, '.py', ['web2py_py.acp'], 'python')
Mixin.setPlugin('dirbrowser', 'set_project', set_project)

def remove_project(ini, projectnames):
    if 'web2py' in projectnames:
        common.remove_acp_highlight(ini, '.html', ['html.acp', 'web2py_html.acp'], 'web2pyview')
        common.remove_acp_highlight(ini, '.py', ['web2py_py.acp'], 'python')
Mixin.setPlugin('dirbrowser', 'remove_project', remove_project)
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id: mMainSubFrame.py 1595 2006-10-12 03:01:34Z limodou $

from modules import Mixin
import MyPanel

class MainSubFrame(MyPanel.SashPanel, Mixin.Mixin):

    __mixinname__ = 'mainsubframe'

    def __init__(self, parent, mainframe):
        self.initmixin()
        self.parent = parent
        self.mainframe = mainframe
        self.mainframe.panel = self

        MyPanel.SashPanel.__init__(self, parent)
        
        self.callplugin('init', self)

def init(win):
    return MainSubFrame(win, win)
Mixin.setPlugin('mainframe', 'init', init)
Exemple #43
0
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id: mChangeFileType.py 1457 2006-08-23 02:12:12Z limodou $

__doc__ = 'Process changing file type event'

from modules import Mixin

def on_document_lang_enter(win, document):
    win.mainframe.changefiletype.enter(win.mainframe, document)
Mixin.setPlugin('editctrl', 'on_document_lang_enter', on_document_lang_enter)

def on_document_lang_leave(win, filename, languagename):
    win.mainframe.changefiletype.leave(win.mainframe, filename, languagename)
Mixin.setPlugin('editctrl', 'on_document_lang_leave', on_document_lang_leave)

def afterinit(win):
    import ChangeFileType

    win.changefiletype = ChangeFileType.ChangeFileType()
Mixin.setPlugin('mainframe', 'afterinit', afterinit)
Exemple #44
0
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id: mPythonFileType.py 1566 2006-10-09 04:44:08Z limodou $

import wx
import FiletypeBase
from modules import Mixin


class PythonFiletype(FiletypeBase.FiletypeBase):

    __mixinname__ = 'pythonfiletype'
    menulist = [
        (None, [
            (890, 'IDM_PYTHON', 'Python', wx.ITEM_NORMAL, None, ''),
        ]),
    ]
    toollist = []  #your should not use supperclass's var
    toolbaritems = {}


def add_filetypes(filetypes):
    filetypes.extend([('python', PythonFiletype)])


Mixin.setPlugin('changefiletype', 'add_filetypes', add_filetypes)
Exemple #45
0
#   Distributed under the terms of the GPL (GNU Public License)
#   
#   UliPad is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id: mTool.py 1566 2006-10-09 04:44:08Z limodou $

import wx
from modules import Mixin

__doc__ = 'Tool menu'

def add_menu(menulist):
    menulist.extend([(None,
        [
            (550, 'IDM_TOOL', tr('Tools'), wx.ITEM_NORMAL, None, ''),
        ]),
    ])
Mixin.setPlugin('mainframe', 'add_menu', add_menu)
Exemple #46
0
    menulist.extend([
        (
            'IDM_VIEW',  #parent menu id
            [
                (170, '', '-', wx.ITEM_SEPARATOR, None, ''),
                (185, 'IDM_VIEW_ZOOM_IN', tr('Zoom In'),
                 wx.ITEM_NORMAL, 'OnViewZoomIn',
                 tr('Increases the font size of the document.')),
                (190, 'IDM_VIEW_ZOOM_OUT', tr('Zoom Out'),
                 wx.ITEM_NORMAL, 'OnViewZoomOut',
                 tr('Decreases the font size of the document.')),
            ]),
    ])


Mixin.setPlugin('mainframe', 'add_menu', add_mainframe_menu)


def add_mainframe_menu_image_list(imagelist):
    imagelist.update({
        'IDM_VIEW_ZOOM_IN': 'images/large.gif',
        'IDM_VIEW_ZOOM_OUT': 'images/small.gif',
    })


Mixin.setPlugin('mainframe', 'add_menu_image_list',
                add_mainframe_menu_image_list)


def OnViewZoomIn(win, event):
    win.document.ZoomIn()
Exemple #47
0
        box.auto_fit(2)
        
        if values:
            box.SetValue(values)
        
    def GetValue(self):
        return self.sizer.GetValue()
    
def add_mainframe_menu(menulist):
    menulist.extend([
        ('IDM_EDIT_FORMAT',
        [
            (126, 'IDM_EDIT_FORMAT_WRAP', tr('Wrap Text...')+'\tCtrl+Shift+T', wx.ITEM_NORMAL, 'OnEditFormatWrap', tr('Wraps selected text.')),
        ]),
    ])
Mixin.setPlugin('mainframe', 'add_menu', add_mainframe_menu)

def add_editor_menu(popmenulist):
    popmenulist.extend([
        ('IDPM_FORMAT',
        [
            (126, 'IDPM_FORMAT_WRAP', tr('Wrap Text...')+'\tE=Ctrl+Shift+T', wx.ITEM_NORMAL, 'OnFormatWrap', tr('Wraps selected text.')),
        ]),
    ])
Mixin.setPlugin('editor', 'add_menu', add_editor_menu)

def OnEditFormatWrap(win, event):
    OnFormatWrap(win.document, event)
Mixin.setMixin('mainframe', 'OnEditFormatWrap', OnEditFormatWrap)

def pref_init(pref):
#   $Id: mPosition.py 1566 2006-10-09 04:44:08Z limodou $

import wx
from modules import Mixin


def on_key_up(win, event):
    if win.edittype == 'edit':
        win.mainframe.SetStatusText(
            tr("Line: %d") % (win.GetCurrentLine() + 1), 1)
        win.mainframe.SetStatusText(
            tr("Column: %d") % (win.GetColumn(win.GetCurrentPos()) + 1), 2)


#        win.mainframe.SetStatusText(tr("Selected: %d") % len(win.GetSelectedText()), 3)
Mixin.setPlugin('editor', 'on_key_up', on_key_up)


def on_mouse_up(win, event):
    if win.edittype == 'edit':
        win.mainframe.SetStatusText(
            tr("Line: %d") % (win.GetCurrentLine() + 1), 1)
        win.mainframe.SetStatusText(
            tr("Column: %d") % (win.GetColumn(win.GetCurrentPos()) + 1), 2)


#        win.mainframe.SetStatusText(tr("Selected: %d") % len(win.GetSelectedText()), 3)
Mixin.setPlugin('editor', 'on_mouse_up', on_mouse_up)


def on_document_enter(win, document):
Exemple #49
0
        ]),
        ('IDPM_SELECTION',
        [
            (100, 'IDPM_SELECTION_SELECT_WORD', tr('Select Word') + '\tCtrl+W', wx.ITEM_NORMAL, 'OnSelectionWord', tr('Selects the current word.')),
            (200, 'IDPM_SELECTION_SELECT_WORD_EXTEND', tr('Select Extended Word') + '\tCtrl+Shift+W', wx.ITEM_NORMAL, 'OnSelectionWordExtend', tr('Selects the current word, including the dot.')),
            (300, 'IDPM_SELECTION_SELECT_PHRASE', tr('Match Select (Left First)') + '\tCtrl+E', wx.ITEM_NORMAL, 'OnSelectionMatchLeft', tr('Selects the text enclosed by () [] {} <> "" \'\', matching left first.')),
            (400, 'IDPM_SELECTION_SELECT_PHRASE_RIGHT', tr('Match Select (Right First)') + '\tCtrl+Shift+E', wx.ITEM_NORMAL, 'OnSelectionMatchRight', tr('Selects the text enclosed by () [] {} <> "" \'\', matching right first.')),
            (500, 'IDPM_SELECTION_SELECT_ENLARGE', tr('Enlarge Selection') + '\tCtrl+Alt+E', wx.ITEM_NORMAL, 'OnSelectionEnlarge', tr('Enlarges the selection.')),
            (600, 'IDPM_SELECTION_SELECT_LINE', tr('Select Line') + '\tCtrl+R', wx.ITEM_NORMAL, 'OnSelectionLine', tr('Selects the current phrase.')),
            (700, 'IDPM_SELECTION_SELECTALL', tr('Select All') + '\tCtrl+A', wx.ITEM_NORMAL, 'OnPopupEdit', tr('Selects the entire document.')),
            (800, 'IDPM_SELECTION_BEGIN', tr('Set Start Of Selection'), wx.ITEM_NORMAL, 'OnSelectionBegin', tr('Sets selection beginning.')),
            (900, 'IDPM_SELECTION_END', tr('Set End Of Selection'), wx.ITEM_NORMAL, 'OnSelectionEnd', tr('Sets selection end.')),
        ]),
    ])
Mixin.setPlugin('editor', 'add_menu', add_editor_menu)

def add_editor_menu_image_list(imagelist):
    imagelist.update({
        'IDPM_UNDO':'images/undo.gif',
        'IDPM_REDO':'images/redo.gif',
        'IDPM_CUT':'images/cut.gif',
        'IDPM_COPY':'images/copy.gif',
        'IDPM_PASTE':'images/paste.gif',
    })
Mixin.setPlugin('editor', 'add_menu_image_list', add_editor_menu_image_list)

def OnPopupEdit(win, event):
    eid = event.GetId()
    if eid == win.IDPM_UNDO:
        win.Undo()
Exemple #50
0
                 None),
            ]),
        ('IDM_FILE_HTML', [
            (100, 'IDM_FILE_HTML_PRINT_PREVIEW',
             tr('HTML Document Preview...'), wx.ITEM_NORMAL,
             'OnFileHtmlPreview',
             tr('Displays the HTML document on the screen as it would appear printed.'
                )),
            (110, 'IDM_FILE_HTML_PRINT', tr('Print HTML Document'),
             wx.ITEM_NORMAL, 'OnFileHtmlPrint',
             tr('Prints the current HTML document.')),
        ]),
    ])


Mixin.setPlugin('mainframe', 'add_menu', add_mainframe_menu)


def add_tool_list(toollist, toolbaritems):
    toollist.extend([
        (125, 'print'),
    ])

    #order, IDname, imagefile, short text, long text, func
    toolbaritems.update({
        'print': (wx.ITEM_NORMAL, 'wx.ID_PRINT', 'images/printer.gif',
                  tr('Print'), tr('Prints a document.'), 'OnFilePrint'),
    })


Mixin.setPlugin('mainframe', 'add_tool_list', add_tool_list)
Exemple #51
0
from modules import Mixin
from modules import Globals
from modules import common

def add_mainframe_menu(menulist):
    menulist.extend([
#        ('IDM_TOOL',
#        [
#            (125, 'IDM_WINDOW_CODESNIPPET', tr('Code Snippets'), wx.ITEM_NORMAL, 'OnWindowCodeSnippet', tr('Opens code snippet window.'))
#        ]),
        ('IDM_WINDOW',
        [
            (151, 'IDM_WINDOW_CODESNIPPET', tr('Code Snippets Window'), wx.ITEM_CHECK, 'OnWindowCodeSnippet', tr('Opens code snippets window.'))
        ]),
    ])
Mixin.setPlugin('mainframe', 'add_menu', add_mainframe_menu)

def add_notebook_menu(popmenulist):
    popmenulist.extend([(None,
        [
            (135, 'IDPM_CODESNIPPETWINDOW', tr('Code Snippets Window'), wx.ITEM_CHECK, 'OnCodeSnippetWindow', tr('Opens code snippet window.')),
        ]),
    ])
Mixin.setPlugin('notebook', 'add_menu', add_notebook_menu)

def add_images(images):
    images.update({
        'close': 'images/folderclose.gif',
        'open': 'images/folderopen.gif',
        'item': 'images/file.gif',
        })
Exemple #52
0
#
# autoacp allows multiple ACP input assistants to be installed when a specified
# language acp is installed.  This plugin was created just for this purpose.
#
# Necessity is the mother of invention -- I thought it would be beneficial to
# have jQuery autocompletion when editing mako files.  Once that was working, it
# seemed like a good idea to have javascript completion when editing mako files.
#
# This plugin allows users to define a custom set of ACP rules, so that when a
# file is opened, the user's "sub" ACP input assistants would be installed.
#

from config import add_mainframe_menu, on_configure, pref_init, \
     on_document_lang_enter
from modules import Mixin

Mixin.setPlugin('preference', 'init', pref_init)
Mixin.setPlugin('mainframe', 'add_menu', add_mainframe_menu)
Mixin.setPlugin('editctrl', 'on_document_lang_enter', on_document_lang_enter)
Mixin.setMixin('mainframe', 'OnConfigureAutoACP', on_configure)
Exemple #53
0
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id: mPythonFileType.py 1566 2006-10-09 04:44:08Z limodou $

import wx
import FiletypeBase
from modules import Mixin

class PythonFiletype(FiletypeBase.FiletypeBase):

    __mixinname__ = 'pythonfiletype'
    menulist = [ (None,
        [
            (890, 'IDM_PYTHON', 'Python', wx.ITEM_NORMAL, None, ''),
        ]),
    ]
    toollist = []               #your should not use supperclass's var
    toolbaritems= {}

def add_filetypes(filetypes):
    filetypes.extend([('python', PythonFiletype)])
Mixin.setPlugin('changefiletype', 'add_filetypes', add_filetypes)
Exemple #54
0
import wx
import os
from modules import Mixin
from modules import Globals

def add_tool_list(toollist, toolbaritems):
    toollist.extend([
        (115, 'dir'),
    ])

    #order, IDname, imagefile, short text, long text, func
    toolbaritems.update({
        'dir':(wx.ITEM_CHECK, 'IDM_WINDOW_DIRBROWSER', 'images/dir.gif', tr('Directory Browser'), tr('Shows the Directory Browser pane.'), 'OnWindowDirBrowser'),
    })
Mixin.setPlugin('mainframe', 'add_tool_list', add_tool_list)

def afterinit(win):
    wx.EVT_UPDATE_UI(win, win.IDM_WINDOW_DIRBROWSER, win.OnUpdateUI)
Mixin.setPlugin('mainframe', 'afterinit', afterinit)

_dirbrowser_pagename = tr('Directory Browser')

def on_mainframe_updateui(win, event):
    eid = event.GetId()
    if eid == win.IDM_WINDOW_DIRBROWSER:
        page = win.panel.getPage(_dirbrowser_pagename)
        event.Check(bool(page) and win.panel.LeftIsVisible)
Mixin.setPlugin('mainframe', 'on_update_ui', on_mainframe_updateui)

def add_mainframe_menu(menulist):
Exemple #55
0
#   $Id$
#   Update by Claudio Grondi 2006/08/14 :
#   added menu shortcut Alt+R - switches the ruler on/off
#   added on_key_down()       - BUT ... column indicator is still not in sync with cursor ...
   
import wx
from modules import Mixin
import unicodedata

def new_control(editor, win, sizer):
    from RulerCtrl import RulerCtrl

    ruler = RulerCtrl(win, offset=cal_offset(editor), show=editor.ruler_show)
    editor.ruler = ruler
    sizer.Add(ruler, 0, wx.EXPAND)
Mixin.setPlugin('textpanel', 'new_control', new_control)

def cal_offset(win):
    return sum(map(win.GetMarginWidth, range(3))) + win.GetMarginLeft()

def cal_column(win):
    text, pos = win.GetCurLine()
    pos = win.GetColumn(win.GetCurrentPos())
    s = 0
    for ch in text[:pos]:
        if unicodedata.east_asian_width(ch) != 'Na':
            s += 2
        else:
            s += 1
    return s
Exemple #56
0
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id: mScript.py 1566 2006-10-09 04:44:08Z limodou $

import wx
import sys
from modules import Mixin
from modules import makemenu


def pref_init(pref):
    pref.scripts = []
    pref.last_script_dir = ''


Mixin.setPlugin('preference', 'init', pref_init)


def add_mainframe_menu(menulist):
    menulist.extend([
        ('IDM_TOOL', [
            (50, 'IDM_SCRIPT', tr('Scripts'), wx.ITEM_NORMAL, None, ''),
        ]),
        (
            'IDM_SCRIPT',  #parent menu id
            [
                (100, 'IDM_SCRIPT_MANAGE', tr('Scripts Manager...'),
                 wx.ITEM_NORMAL, 'OnScriptManage', tr('Script manager.')),
                (110, '', '-', wx.ITEM_SEPARATOR, None, ''),
                (120, 'IDM_SCRIPT_ITEMS', tr('(Empty)'), wx.ITEM_NORMAL,
                 'OnScriptItems', tr('Executes an script.')),
Exemple #57
0
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id: mClassBrowser.py 1897 2007-02-03 10:33:43Z limodou $

import wx
from modules import Mixin
from modules import Globals
from modules.Debug import error

def pref_init(pref):
    pref.python_classbrowser_show = False
    pref.python_classbrowser_refresh_as_save = True
    pref.python_classbrowser_show_docstring = False
    pref.python_classbrowser_sort = True
    pref.python_classbrowser_show_side = 'RIGHT'
Mixin.setPlugin('preference', 'init', pref_init)

def add_pref(preflist):
    preflist.extend([
        ('Python', 100, 'check', 'python_classbrowser_show', tr('Show class browser window when opening python source file'), None),
        ('Python', 105, 'check', 'python_classbrowser_refresh_as_save', tr('Refresh class browser window when saving python source file'), None),
        ('Python', 106, 'check', 'python_classbrowser_show_docstring', tr('Show docstring when cursor moving on a node of class browser tree'), None),
#        ('Python', 107, 'check', 'python_classbrowser_sort', tr('Sort identifiers by alphabet in class browser'), None),
        ('Python', 108, 'choice', 'python_classbrowser_show_side', tr('Show class browser in side:'), [('Left', 'LEFT'), ('Right', 'RIGHT')]),
    ])
Mixin.setPlugin('preference', 'add_pref', add_pref)

def add_mainframe_menu(menulist):
    menulist.extend([('IDM_PYTHON', #parent menu id
            [
                (100, 'IDM_PYTHON_CLASSBROWSER', tr('Class Browser')+'\tE=Alt+V', wx.ITEM_CHECK, 'OnPythonClassBrowser', tr('Show python class browser window.')),
Exemple #58
0
except:
    from sets import Set as set

import os
import glob
from modules import Mixin
from modules.Debug import error
from modules import Globals
from modules import common
from modules import dict4ini

CALLTIP_AUTOCOMPLETE = 2

def mainframe_init(win):
    win.input_assistant = None
Mixin.setPlugin('mainframe', 'init', mainframe_init)

def editor_init(win):
    win.AutoCompSetIgnoreCase(True)
    win.AutoCompStops(' .,;:()[]{}\'"\\<>%^&+-=*/|`')
    win.AutoCompSetAutoHide(True)
    win.AutoCompSetCancelAtStart(False)

#    win.inputassistant_obj = None
    win.replace_strings = None
    win.word_len = 0
    win.custom_assistant = []
    win.function_parameter = []
    win.calltip_stack = {} # collecting nested calltip's text and pos.
    win.syntax_info = None
    win.auto_routin = None
Exemple #59
0
        common.showerror(win, tr('There is something wrong as running Blog Edit'))
Mixin.setMixin('mainframe', 'OnWindowBlog', OnWindowBlog)

def OnBlogWindow(win, event):
    try:
        win.mainframe.createBlogWindow()
        win.panel.showPage('Blog')
    except:
        error.traceback()
        common.showerror(win, tr('There is something wrong as running Blog Edit'))
Mixin.setMixin('notebook', 'OnBlogWindow', OnBlogWindow)

blog_resfile = os.path.join(__path__[0], 'blogmanagedialog.xrc')
def afterinit(win):
    win.blog_resfile = blog_resfile
Mixin.setPlugin('mainframe', 'afterinit', afterinit)

def init(pref):
    pref.blog_sites = []
    pref.blog_sites_info = {}
    pref.last_blog_site = 0
Mixin.setPlugin('preference', 'init', init)

toollist = [
        (128, 'blog'),
]
Mixin.setMixin('mainframe', 'toollist', toollist)

#order, IDname, imagefile, short text, long text, func
toolbaritems = {
        'blog':(wx.ITEM_NORMAL, 'IDM_NEW_BLOG', images.getBlogBitmap(), tr('new blog'), tr('Opens new blog window.'), 'OnNewBlog'),
Exemple #60
0
import wx
from modules import Mixin
from modules import Globals


def add_editor_menu(popmenulist):
    popmenulist.extend([
        (None, [
            (200, 'IDPM_MULTIVIEWWINDOW', tr('Open Multiview Window'),
             wx.ITEM_NORMAL, 'OnMultiViewWindow',
             tr('Opens the multiview window.')),
        ]),
    ])


Mixin.setPlugin('notebook', 'add_menu', add_editor_menu)


def createMultiViewWindow(win, side, document):
    dispname = document.getShortFilename()
    filename = document.filename

    obj = None
    for pagename, panelname, notebook, page in win.panel.getPages():
        if is_multiview(page, document):
            obj = page
            break
    if not obj:
        if hasattr(document, 'GetDocPointer'):
            from mixins import Editor