コード例 #1
0
ファイル: UliPad.py プロジェクト: zztalker/ulipad
    def init(self, showSplash=True, load=True):

        #add modules path to sys.path
        self.workpath = workpath
        self.confpath = confpath
        self.curpath = curpath
        self.i18n = i18n

        self.processCommandLineArguments()

        if self.psycoflag:
            try:
                import psyco
                psyco.full()
            except:
                pass

        #change workpath
        self.userpath = self.workpath
        if self.multiuser:
            self.userpath = common.getHomeDir()

        #set globals variable
        Globals.userpath = self.userpath

        self.CheckPluginDir()

        Mixin.ENABLE = True
        try:
            import plugins
        except:
            Debug.error.traceback()
            common.showerror(
                None, tr('There was something wrong with importing plugins.'))

        #before running gui
        self.callplugin("beforegui", self)

        Mixin.ENABLE = False
        #-----------------------------------------------------------------------------

        if Debug.DEBUG:
            Mixin.printMixin()

        return self.execplugin('getmainframe', self, self.files)
コード例 #2
0
def on_first_char(win, event):
    global _impact_mode, buf
    if _impact_mode:
        key = event.GetKeyCode()
        if key < 127:
            buf.append(chr(key))
            showinfo(' '.join(buf))
            Mixin.reload_obj(Commands)
            commandar = Commands.getinstance()
            s = commandar.impact_search(''.join(buf))
            if len(s) == 1:  #find a cmd
                showinfo(' '.join(buf + ['(' + s[0][0] + ')']))
                cmd_id = s[0][-1]
                commandar.run(cmd_id)
                buf = []
            elif len(s) == 0:
                buf = []
        return True
コード例 #3
0
ファイル: mCommands.py プロジェクト: LaoMa3953/ulipad
def on_first_char(win, event):
    global _impact_mode, buf
    if _impact_mode:
        key = event.GetKeyCode()
        if key < 127:
            buf.append(chr(key))
            showinfo(' '.join(buf))
            Mixin.reload_obj(Commands)
            commandar = Commands.getinstance()    
            s = commandar.impact_search(''.join(buf))
            if len(s) == 1:     #find a cmd
                showinfo(' '.join(buf + ['('+s[0][0]+')']))
                cmd_id = s[0][-1]
                commandar.run(cmd_id)
                buf = []
            elif len(s) == 0:
                buf = []
        return True
コード例 #4
0
ファイル: UliPad.py プロジェクト: LaoMa3953/ulipad
    def init(self, showSplash=True, load=True):

        #add modules path to sys.path
        self.workpath = workpath
        self.confpath = confpath
        self.curpath = curpath
        self.i18n = i18n

        self.processCommandLineArguments()

        if self.psycoflag:
            try:
                import psyco
                psyco.full()
            except:
                pass

        #change workpath
        self.userpath = self.workpath
        if self.multiuser:
            self.userpath = common.getHomeDir()

        #set globals variable
        Globals.userpath = self.userpath

        self.CheckPluginDir()

        Mixin.ENABLE = True
        try:
            import plugins
        except:
            Debug.error.traceback()
            common.showerror(None, tr('There was something wrong with importing plugins.'))

        #before running gui
        self.callplugin("beforegui", self)

        Mixin.ENABLE = False
        #-----------------------------------------------------------------------------

        if Debug.DEBUG:
            Mixin.printMixin()

        return self.execplugin('getmainframe', self, self.files)
コード例 #5
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.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'
コード例 #6
0
ファイル: mCustomLexer.py プロジェクト: LinYuanLab/ulipad
#
#   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)
コード例 #7
0
ファイル: mWizard.py プロジェクト: LaoMa3953/ulipad
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id: mSnippets.py,v 1.8 2004/11/27 15:52:08 limodou Exp $

from modules import Mixin
import wx
import images

menulist = [
    ('IDM_WINDOW',
    [
        (190, 'IDM_WINDOW_WIZARD', tr('Wizard Window'), wx.ITEM_CHECK, 'OnWindowWizard', tr('Opens wizard window.'))
    ]),
]
Mixin.setMixin('mainframe', 'menulist', menulist)

popmenulist = [ (None,
    [
        (140, 'IDPM_WIZARDWINDOW', tr('Wizard Window'), wx.ITEM_CHECK, 'OnWizardWindow', tr('Opens wizard window.')),
    ]),
]
Mixin.setMixin('notebook', 'popmenulist', popmenulist)

toollist = [
        (550, 'wizard'),
]
Mixin.setMixin('mainframe', 'toollist', toollist)

_wizard_pagename = tr('Wizard')
コード例 #8
0
ファイル: mSyntaxCheck.py プロジェクト: zztalker/ulipad
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id$

import wx
from modules import Mixin

menulist = [
    (
        'IDM_PYTHON',  #parent menu id
        [
            (170, 'IDM_PYTHON_CHECK', tr('Check Syntax'), wx.ITEM_NORMAL,
             'OnPythonCheck', tr('Check python source code syntax.')),
        ]),
]
Mixin.setMixin('pythonfiletype', 'menulist', menulist)


def add_tool_list(toollist, toolbaritems):
    toollist.extend([
        (2140, 'check'),
    ])

    #order, IDname, imagefile, short text, long text, func
    toolbaritems.update({
        'check': (wx.ITEM_NORMAL, 'IDM_PYTHON_CHECK', 'images/spellcheck.gif',
                  tr('Check Syntax'), tr('Check python source code syntax.'),
                  'OnPythonCheck'),
    })

コード例 #9
0
ファイル: mLineending.py プロジェクト: LaoMa3953/ulipad
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):
コード例 #10
0
ファイル: __init__.py プロジェクト: LaoMa3953/ulipad
#   $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
コード例 #11
0
ファイル: mVersionControl.py プロジェクト: zztalker/ulipad
#   Copyleft 2006 limodou
#
#   Distributed under the terms of the GPL (GNU Public License)
#
#   NewEdit 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$

import wx
from modules import Mixin


def pref_init(pref):
    pref.version_control_export_path = ''
    pref.version_control_checkout_path = ''


Mixin.setPlugin('preference', 'init', pref_init)
コード例 #12
0
ファイル: mRegex.py プロジェクト: zztalker/ulipad
import wx
from modules import Mixin

regex_pagename = tr("Regex")


def createRegexWindow(win):
    if not win.panel.getPage(regex_pagename):
        from mixins import RegexWindow

        page = RegexWindow.RegexWindow(win.panel.createNotebook('bottom'))
        win.panel.addPage('bottom', page, regex_pagename)
    return regex_pagename


Mixin.setMixin('mainframe', 'createRegexWindow', createRegexWindow)


def add_mainframe_menu(menulist):
    menulist.extend([
        (
            'IDM_TOOL',  #parent menu id
            [
                (170, 'IDM_TOOL_REGEX', tr('Live Regular Expression'),
                 wx.ITEM_NORMAL, 'OnToolRegex',
                 tr('Live regular expression searching.')),
            ]),
    ])


Mixin.setPlugin('mainframe', 'add_menu', add_mainframe_menu)
コード例 #13
0
ファイル: dirbrowser_ext.py プロジェクト: zztalker/ulipad
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)
コード例 #14
0
ファイル: mRestFileType.py プロジェクト: LaoMa3953/ulipad
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)
コード例 #15
0
ファイル: editor_ext.py プロジェクト: zztalker/ulipad
        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)
コード例 #16
0
ファイル: mRubyFileType.py プロジェクト: LaoMa3953/ulipad
#   (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$

import wx
from modules import Mixin
from mixins import FiletypeBase

class RubyFiletype(FiletypeBase.FiletypeBase):

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

filetype = [('ruby', RubyFiletype)]
Mixin.setMixin('changefiletype', 'filetypes', filetype)
コード例 #17
0
ファイル: mConfig.py プロジェクト: LaoMa3953/ulipad
#   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)
コード例 #18
0
ファイル: __init__.py プロジェクト: LaoMa3953/ulipad
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id$

from modules import Mixin
import wx
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'),
コード例 #19
0
ファイル: mLexer.py プロジェクト: barry963/Robot_project
        (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),
コード例 #20
0
        if DDE.senddata('\r\n'.join(filenames), port=port):
            print """Found previous instance of UliPad and the files will be 
opened in it, current instance will be quit. If you have not 
seen the UliPad started, please change the DDE support port at 
config.ini with :

    [server]
    port=50001 #or other port number

If it's alreay exit, contact ulipad author to get help."""
            sys.exit(0)
        else:
            DDE.run(port=port)


Mixin.setPlugin('app', 'dde', app_init, Mixin.HIGH, 0)


def afterclosewindow(win):
    if win.app.ddeflag:
        DDE.stop()


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


def openfiles(win, files):
    if files:
        doc = None
        firstdoc = None
        for filename in files:
コード例 #21
0
ファイル: mReloadMixins.py プロジェクト: LinYuanLab/ulipad
from modules import Mixin
import ReloadMixins


def add_mainframe_menu(menulist):
    menulist.extend([('IDM_TOOL', #parent menu id
        [
            (138, 'IDM_TOOL_AUTO_LOAD_MIXINS', tr('Autoreload Mixins'), wx.ITEM_NORMAL, '', ''),
        ]),
        ('IDM_TOOL_AUTO_LOAD_MIXINS',
        [
            (110, 'IDM_TOOL_MIXINS_NAME', tr('Select Mixins Name To Reload') +'\tCtrl+M', wx.ITEM_NORMAL, 'OnToolReloadName', tr('Selects Mixin names to reload.')),
            (120, 'IDM_TOOL_ENABLE_RELOAD_MIXINS', tr('Enable Reload Mixins') +'\tCtrl+Shift+M', wx.ITEM_CHECK, 'OnToolreload_mixins', tr('Switches to Mixins reload mode.')),
        ]),
    ])
Mixin.setPlugin('mainframe', 'add_menu', add_mainframe_menu)


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


def on_mainframe_updateui(win, event):
    eid = event.GetId()
    if eid == win.IDM_TOOL_ENABLE_RELOAD_MIXINS:
        event.Check(win.pref.mixin_reload_mixins_mode)
    if  eid == win.IDM_TOOL_MIXINS_NAME:
        if  win.pref.mixin_reload_mixins_mode:
            event.Enable(True)
コード例 #22
0
ファイル: mTool.py プロジェクト: zztalker/ulipad
#   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)
コード例 #23
0
def pref_init(pref):
    s = check_lua()
    pref.lua_interpreter = s
    if len(s) == 1:
        pref.default_lua_interpreter = s[0][0]
    else:
        pref.default_lua_interpreter = 'noexist'
    pref.lua_show_args = False
    pref.lua_save_before_run = False
    pref.lua_default_paramters = {}
    for i in s:
        pref.lua_default_paramters[i[0]] = '-e "io.stdout:setvbuf \'no\'"'


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


def OnSetLuaInterpreter(win, event):
    dlg = LuaInterpreterDialog(win, win.pref)
    dlg.ShowModal()


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


def add_pref(preflist):
    preflist.extend([
        ('Lua', 150, 'button', 'lua_interpreter',
         tr('Setup Lua interpreter...'), 'OnSetLuaInterpreter'),
        ('Lua', 155, 'check', 'lua_show_args',
コード例 #24
0
#   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
コード例 #25
0
        inPartialShortcut = True
        currentPartialMatch = scs
        return True

    # Allow for '<'
    if scs == 'shift+,':
        return False

    if len(scs.split(',')) > 1 and scs != ',':  # multi-key shortcut reach here
        # means invalid key
        return True

    return False


Mixin.setPlugin('editor', 'on_first_keydown', keyDown, nice=0)


def matchPartial(scs, shortcuts):
    for key in shortcuts.keys():
        if scs == key.split(',')[0]:
            return True
    return False


def assembleShortcutString(event):
    global inPartialShortcut
    global currentPartialMatch

    key = event.GetKeyCode()
    sc = ''
コード例 #26
0
ファイル: mCTags.py プロジェクト: thegooglecodearchive/ulipad
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)
コード例 #27
0
ファイル: mRun.py プロジェクト: LinYuanLab/ulipad
    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:
コード例 #28
0
#   $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)
コード例 #29
0
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:
コード例 #30
0
ファイル: mChangeFileType.py プロジェクト: LinYuanLab/ulipad
#   (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)
コード例 #31
0
ファイル: mFortranFileType.py プロジェクト: LinYuanLab/ulipad
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)

コード例 #32
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
from mixins import FiletypeBase


class LuaFiletype(FiletypeBase.FiletypeBase):

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


filetype = [('lua', LuaFiletype)]
Mixin.setMixin('changefiletype', 'filetypes', filetype)
コード例 #33
0
ファイル: mWrapText.py プロジェクト: LaoMa3953/ulipad
        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):
コード例 #34
0
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id$

import wx
import os.path
from modules import Mixin
from modules import Globals


def init(pref):
    pref.lua_classbrowser_show = False
    pref.lua_classbrowser_refresh_as_save = True


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

preflist = [
    ('Lua', 100, 'check', 'lua_classbrowser_show',
     tr('Show class browser window as open lua source file'), None),
    ('Lua', 105, 'check', 'lua_classbrowser_show',
     tr('Refresh class browser window as saved lua source file'), None),
]
Mixin.setMixin('preference', 'preflist', preflist)

menulist = [
    (
        'IDM_LUA',  #parent menu id
        [
            (100, 'IDM_LUA_CLASSBROWSER', tr('Class Browser'), wx.ITEM_CHECK,
             'OnLuaClassBrowser', tr('Show lua class browser window')),
コード例 #35
0
ファイル: mComEdit.py プロジェクト: barry963/Robot_project
        ]),
        ('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()
コード例 #36
0
ファイル: __init__.py プロジェクト: zztalker/ulipad
    win.m3u = None
    win.isloop = True
    win.src = None
    win.selectedid = -1
    win.musiclist = None
    win.music = pySonic.World()
    win.flag_pause = False
    win.playing = None
    win.playingid = None

    wx.EVT_UPDATE_UI(win, win.IDM_MUSIC_PLAY, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDM_MUSIC_STOP, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDM_MUSIC_PAUSE, win.OnUpdateUI)


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


def afterclosewindow(win):
    if win.src:
        try:
            if win.src.IsPlaying():
                win.isloop = False
                win.src.Stop()
                time.sleep(0.5)
        except:
            pass


Mixin.setPlugin('mainframe', 'afterclosewindow', afterclosewindow)
コード例 #37
0
ファイル: mCodeSnippet.py プロジェクト: zztalker/ulipad
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',
        })
コード例 #38
0
ファイル: mAutoBak.py プロジェクト: LaoMa3953/ulipad
#   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)
コード例 #39
0
                flag = True
                break

    else:
        #        if filename:
        #            win.mainframe.lexers.getNamedLexer('text').colourize(win)
        #        else:
        if not hasattr(win, 'lexer'):
            lexer_obj = Globals.mainframe.lexers.getDefaultLexer()
            flag = True
    if flag:
        lexer_obj.colourize(win)
        wx.CallAfter(Globals.mainframe.editctrl.switch, win)


Mixin.setPlugin('editor', 'call_lexer', call_lexer)
Mixin.setPlugin('dirbrowser', 'call_lexer', call_lexer)

#def aftersavefile(win, filename):
#    for lexer in win.mainframe.lexers.lexobjs:
#        if lexer.matchfile(filename) and lexer != win.lexer:
##            lexer.colourize(win)
#            return
#Mixin.setPlugin('editor', 'aftersavefile', aftersavefile)


def beforeinit(win):
    win.lexers = LexerFactory(win)


Mixin.setPlugin('mainframe', 'beforeinit', beforeinit)
コード例 #40
0
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   $Id: mEncoding.py 1897 2007-02-03 10:33:43Z limodou $

import wx
from modules import Mixin
from modules import common


def pref_init(pref):
    pref.select_encoding = False
    pref.default_encoding = common.defaultencoding
    pref.custom_encoding = ''


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

encodings = [common.defaultencoding]
if 'UTF-8' not in encodings and 'UTF8' not in encodings:
    encodings.append('UTF-8')


def add_pref(preflist):
    preflist.extend([
        (tr('General'), 120, 'check', 'select_encoding',
         tr('Show encoding dialog at file opening and at file saving'), None),
        (tr('Document'), 190, 'choice', 'default_encoding',
         tr('Default document encoding:'), encodings),
        (tr('Document'), 191, 'text', 'custom_encoding',
         tr("Set custom encoding to be default:"), None),
    ])
コード例 #41
0
ファイル: mPythonFileType.py プロジェクト: LaoMa3953/ulipad
#
#   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)
コード例 #42
0
ファイル: mDebug.py プロジェクト: barry963/Robot_project
#   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
import wx
import os
from modules import common

menulist = [('IDM_PYTHON', #parent menu id
                [
                        (160, 'IDM_PYTHON_DEBUG', tr('Debug In WinPdb'), wx.ITEM_NORMAL, 'OnPythonDebug', tr('Debug the current program in WinPdb.')),
                ]),
]
Mixin.setMixin('pythonfiletype', 'menulist', menulist)

toollist = [
        (2130, 'debug'),
]
Mixin.setMixin('pythonfiletype', 'toollist', toollist)

#order, IDname, imagefile, short text, long text, func
toolbaritems = {
        'debug':(wx.ITEM_NORMAL, 'IDM_PYTHON_DEBUG', 'images/debug.png', tr('Debug'), tr('Debug the current program in WinPdb.'), 'OnPythonDebug'),
}
Mixin.setMixin('pythonfiletype', 'toolbaritems', toolbaritems)

def OnPythonDebug(win, event):
    interpreters = dict(win.pref.python_interpreter)
    interpreter = interpreters.get(win.pref.default_interpreter, '')
コード例 #43
0
ファイル: mFtp.py プロジェクト: LinYuanLab/ulipad
#   $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)
コード例 #44
0
ファイル: dirbrowser_ext.py プロジェクト: zztalker/ulipad
#   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 common
from modules import Mixin

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


def set_project(ini, projectnames):
    if 'mako' in projectnames:
        common.set_acp_highlight(ini, '.mko', ['html.acp', 'makohtml.acp'],
                                 'makotmp')


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


def remove_project(ini, projectnames):
    if 'mako' in projectnames:
        common.remove_acp_highlight(ini, '.mko', ['html.acp', 'makohtml.acp'],
                                    'makotmp')
コード例 #45
0
                 wx.ITEM_NORMAL, 'OnHelpMaillist',
                 tr('Visit Project Mail List: %s.') % maillist),
                (230, 'IDM_HELP_MYBLOG', tr('Visit My Blog'), wx.ITEM_NORMAL,
                 'OnHelpMyBlog', tr('Visit My blog: %s.') % blog),
                (240, 'IDM_HELP_ULISPOT', tr('Visit UliPad Snippets Site'),
                 wx.ITEM_NORMAL, 'OnHelpUlispot',
                 tr('Visit UliPad snippets site: %s.') % ulispot),
                (250, 'IDM_HELP_EMAIL', tr('Contact Me'), wx.ITEM_NORMAL,
                 'OnHelpEmail', tr('Send email to me mailto:%s.') % email),
                (900, 'wx.ID_ABOUT', tr('About...'), wx.ITEM_NORMAL,
                 'OnHelpAbout', tr('About this program.')),
            ]),
    ])


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


def OnHelpIndex(win, event):
    lang = 'en'
    if Globals.app.i18n.lang:
        lang = Globals.app.i18n.lang
    filename = common.get_app_filename(win, 'doc/%s/index.htm' % lang)
    if not os.path.exists(filename):
        filename = common.get_app_filename(win, 'doc/%s/index.htm' % 'en')
    common.webopen(filename)


Mixin.setMixin('mainframe', 'OnHelpIndex', OnHelpIndex)

コード例 #46
0
    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()
コード例 #47
0
ファイル: mIcon.py プロジェクト: LaoMa3953/ulipad
#   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)
コード例 #48
0
ファイル: mMDFileType.py プロジェクト: zztalker/ulipad
"""

class MDFiletype(FiletypeBase.FiletypeBase):

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

def add_filetypes(filetypes):
    filetypes.extend([('md', MDFiletype)])
Mixin.setPlugin('changefiletype', 'add_filetypes', add_filetypes)

def add_rest_menu(menulist):
    menulist.extend([('IDM_MARKDOWN', #parent menu id
            [
                (100, 'IDM_MD_VIEW_IN_LEFT', tr('View HTML Result In Left Pane'), wx.ITEM_NORMAL, 'OnMDViewHtmlInLeft', tr('Views HTML result in left pane.')),
                (110, 'IDM_MD_VIEW_IN_BOTTOM', tr('View HTML Result In Bottom Pane'), wx.ITEM_NORMAL, 'OnMDViewHtmlInBottom', tr('Views HTML result in bottom pane.')),
            ]),
    ])
Mixin.setPlugin('mdfiletype', 'add_menu', add_rest_menu)

def OnMDViewHtmlInLeft(win, event):
    dispname = win.createMDHtmlViewWindow('left', Globals.mainframe.editctrl.getCurDoc())
    if dispname:
        win.panel.showPage(dispname)
Mixin.setMixin('mainframe', 'OnMDViewHtmlInLeft', OnMDViewHtmlInLeft)
コード例 #49
0
ファイル: mClassBrowser.py プロジェクト: LaoMa3953/ulipad
#   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.')),
コード例 #50
0
    __mixinname__ = 'htmlfiletype'
    menulist = [
        (None, [
            (890, 'IDM_HTML', 'HTML', wx.ITEM_NORMAL, None, ''),
        ]),
    ]
    toollist = []  #your should not use supperclass's var
    toolbaritems = {}


def add_filetypes(filetypes):
    filetypes.extend([('html', HtmlFiletype)])


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


def add_html_menu(menulist):
    menulist.extend([
        (
            'IDM_HTML',  #parent menu id
            [
                (100, 'IDM_HTML_BROWSER_LEFT',
                 tr('View HTML Content In Left Pane'),
                 wx.ITEM_NORMAL, 'OnHtmlBrowserInLeft',
                 tr('Views html content in left pane.')),
                (110, 'IDM_HTML_BROWSER_BOTTOM',
                 tr('View HTML Content In Bottom Pane'), wx.ITEM_NORMAL,
                 'OnHtmlBrowserInBottom',
                 tr('Views html content in bottom pane.')),
コード例 #51
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):
コード例 #52
0
def add_mainframe_menu(menulist):
    menulist.extend([
        (
            'IDM_FILE',
            [
                (130, 'IDM_FILE_RECENTFILES',
                 tr('Recent Files...') + '\tAlt+R', wx.ITEM_NORMAL,
                 'OnOpenRecentFiles',
                 'Shows recently opened files in a pop-up menu.'),
                #            (135, 'IDM_FILE_RECENTPATHS', tr('Open Recent Paths'), wx.ITEM_NORMAL, 'OnOpenRecentPaths', 'Opens recent paths.'),
            ]),
    ])


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


def pref_init(pref):
    pref.recent_files = []
    pref.recent_files_num = 20


#    pref.recent_paths = []
#    pref.recent_paths_num = 10
Mixin.setPlugin('preference', 'init', pref_init)


def afteropenfile(win, filename):
    if Globals.starting:
        return
コード例 #53
0
ファイル: __init__.py プロジェクト: zztalker/ulipad
#
#       $Id: BlogEdit.py 42 2005-09-28 05:19:21Z limodou $

from modules import Mixin
import os.path
import wx
import images
from modules.Debug import error
from modules import common

menulist = [ ('IDM_WINDOW',
        [
                (170, 'IDM_WINDOW_BLOG', tr('Open Blog Window'), wx.ITEM_NORMAL, 'OnWindowBlog', tr('Opens blog window.'))
        ]),
]
Mixin.setMixin('mainframe', 'menulist', menulist)

popmenulist = [ (None,
        [
                (150, 'IDPM_BLOGWINDOW', tr('Open Blog Window'), wx.ITEM_NORMAL, 'OnBlogWindow', tr('Opens blog window.')),
        ]),
]
Mixin.setMixin('notebook', 'popmenulist', popmenulist)

def createBlogWindow(win):
    page = win.panel.getPage('Blog')
    if not page:
        from BlogManageWindow import BlogManageWindow

        page = BlogManageWindow(win.panel.createNotebook('bottom'), win)
        win.panel.addPage('bottom', page, 'Blog')
コード例 #54
0
ファイル: mWindow.py プロジェクト: zztalker/ulipad
            (120, '-', '', wx.ITEM_SEPARATOR, '', ''),
            (130, 'IDM_WINDOW_SHELL', tr('Shell Window'), wx.ITEM_CHECK,
             'OnWindowShell', tr('Shows the Shell pane.')),
            (140, 'IDM_WINDOW_MESSAGE', tr('Messages Window'), wx.ITEM_CHECK,
             'OnWindowMessage', tr('Shows the Messages pane.')),
        ]),
        ('IDM_EDIT', [
            (280, '-', '', wx.ITEM_SEPARATOR, '', ''),
            (290, 'IDM_EDIT_CLEARSHELL',
             tr('Clear Shell Contents') + '\tCtrl+Alt+R', wx.ITEM_NORMAL,
             'OnEditClearShell', tr('Clears the contents of the shell.')),
        ]),
    ])


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


def OnWindowLeft(win, event):
    flag = not win.panel.LeftIsVisible

    #    if flag:
    #        win.createSnippetWindow()
    #
    win.panel.showWindow('left', flag)


Mixin.setMixin('mainframe', 'OnWindowLeft', OnWindowLeft)


def OnWindowBottom(win, event):