Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /newedit/src/, /newedit/src/mixins/, /newedit/src/modules/

newedit
Discussion topic

Back to topic list

CVS update: /newedit/src/, /newedit/src/mixins/, /newedit/src/modules/

Reply

Author limodou
Full name limodou
Date 2004-05-15 08:11:37 PDT
Message User: limodou
Date: 04/05/15 08:11:37

Removed:
 /newedit/src/
  README.txt

Added:
 /newedit/src/mixins/
  DClickCloseFile.py, Format.py, OnUpdateUI.py, SetScrollWidth.py, View.py

Modified:
 /newedit/src/
  ChangeLog.txt
 /newedit/src/mixins/
  ComEdit.py, Editor.py, OnModified.py, Search.py, Toolbar.py, __init__.py
 /newedit/src/modules/
  Accelerator.py, Mixin.py, maketoolbar.py

Log:
 update

File Changes:

Directory: /newedit/src/
========================

File [changed]: ChangeLog.txt
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/ChangeLo​g.txt?r1=1.6&r2=​1.7
Delta lines: +6 -0
-------------------
--- ChangeLog.txt 15 May 2004 06:20:47 -0000 1.6
+++ ChangeLog.txt 15 May 2004 15:11:32 -0000 1.7
@@ -3,6 +3,12 @@
 OnUpdateUI.py Ôö¼Ó¶Ôcut, copy, paste, undo, redo, save¹¤¾ß¡¢²Ëµ¥µÄ¶¯Ì¬¸üÐÂ
 SetScrollWidth.py Ôö¼Ó³õʼÉèÖÃStyledTe​xtCtrlºáÏò¹ö¶¯Ìõ¿í¶È​
 Editor.py ²åÈë¹â±ê¿í¶ÈÉèΪ3£¬µ​÷ÕûµÚÒ»ÁÐmarginΪ·ûº​Ŷø²»ÊÇÐкÅ
+ComEdit.py ¸´ÖÆÒ»ÐÐ,¸´ÖÆÉÏÐÐ×Ö·û
+maketoolbar.py ¸üÐÂtoolbar¸ñʽ£¬Ôö¼ÓÑùʽÏî
+Format.py Ôö¼Ó¸ñʽ²Ëµ¥
+DClickCloseFile.py Ë«»÷tab½«¹Ø±ÕtabÒ³
+View.py Ôö¼ÓÊÓͼ²Ëµ¥£¬¿ÉÒÔÏÔ​ʾ/²»ÏÔʾ¿Õ°×ºÍÖƱí·​û
+Toolbar.py Ö§³Ötoggle¹¤¾ß
 
 [2004/05/14]
 Search.py Ôö¼Ó²éÕÒ¡¢Ìæ»»¹¦ÄÜ£¬​Ôö¼Ó¹¤¾ßÌõÏÔʾ£¬½«Ñ¡​ÖÐÎı¾Ö±½Ó½øÐвéÕÒ¹¦​ÄÜ

File [removed]: README.txt

Directory: /newedit/src/mixins/
===============================

File [changed]: ComEdit.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/mixins/C​omEdit.py?r1=1.1​&r2=1.2
Delta lines: +42 -10
---------------------
--- ComEdit.py 12 May 2004 07:04:19 -0000 1.1
+++ ComEdit.py 15 May 2004 15:11:32 -0000 1.2
@@ -7,13 +7,17 @@
 popmenulist = [ (0, #parent menu id
     [
         (100, 'IDPM_UNDO', 'Undo\tCtrl+Z', wx.ITEM_NORMAL, 'OnUndo', ''),
- (150, 'IDPM_REDO', 'Redo\tCtrl+Y', wx.ITEM_NORMAL, 'OnRedo', ''),
- (200, '', '-', wx.ITEM_SEPARATOR, None, ''),
- (250, 'IDPM_CUT', 'Cut\tCtrl+X', wx.ITEM_NORMAL, 'OnPopupEdit', ''),
- (300, 'IDPM_COPY', 'Copy\tCtrl+C', wx.ITEM_NORMAL, 'OnPopupEdit', ''),
- (350, 'IDPM_PASTE', 'Paste\tCtrl+V', wx.ITEM_NORMAL, 'OnPopupEdit', ''),
- (400, '', '-', wx.ITEM_SEPARATOR, None, ''),
- (450, 'IDPM_SELECT_ALL', 'Select All\tCtrl+A', wx.ITEM_NORMAL, 'OnPopupEdit', ''),
+ (110, 'IDPM_REDO', 'Redo\tCtrl+Y', wx.ITEM_NORMAL, 'OnRedo', ''),
+ (120, '', '-', wx.ITEM_SEPARATOR, None, ''),
+ (130, 'IDPM_CUT', 'Cut\tCtrl+X', wx.ITEM_NORMAL, 'OnPopupEdit', ''),
+ (140, 'IDPM_COPY', 'Copy\tCtrl+C', wx.ITEM_NORMAL, 'OnPopupEdit', ''),
+ (150, 'IDPM_PASTE', 'Paste\tCtrl+V', wx.ITEM_NORMAL, 'OnPopupEdit', ''),
+ (160, '', '-', wx.ITEM_SEPARATOR, None, ''),
+ (170, 'IDPM_SELECTION', 'Selection', wx.ITEM_NORMAL, None, ''),
+ ]),
+ (170,
+ [
+ (100, 'IDPM_SELECTION_SELECTALL', 'Select All\tCtrl+A', wx.ITEM_NORMAL, 'OnPopupEdit', ''),
     ]),
 ]
 Mixin.setMixin('editor', 'popmenulist', popmenulist)
@@ -34,7 +38,7 @@
         win.CmdKeyExecute(wx​.stc.STC_CMD_COPY)
     elif eid == win.IDPM_PASTE:
         win.CmdKeyExecute(wx​.stc.STC_CMD_PASTE)
- elif eid == win.IDPM_SELECT_ALL:
+ elif eid == win.IDPM_SELECTION_SELECTALL:
         win.CmdKeyExecute(wx​.stc.STC_CMD_SELECTA​LL)
 Mixin.setMixin('editor', 'OnPopupEdit', OnPopupEdit)
 
@@ -51,7 +55,14 @@
         (205, 'IDM_EDIT_COPY', 'Copy\tCtrl+C', wx.ITEM_NORMAL, 'DoSTCBuildIn', 'Copy selected text to clipboard'),
         (206, 'IDM_EDIT_PASTE', 'Paste\tCtrl+V', wx.ITEM_NORMAL, 'DoSTCBuildIn', 'Paste text from clipboard'),
         (210, '', '-', wx.ITEM_SEPARATOR, None, ''),
- (215, 'IDM_SELECT_ALL', 'Select All\tCtrl+A', wx.ITEM_NORMAL, 'DoSTCBuildIn', 'Select all text of the document'),
+ (215, 'IDM_EDIT_SELECTION', 'Selection', wx.ITEM_NORMAL, None, 'Select all text of the document'),
+ (220, '', '-', wx.ITEM_SEPARATOR, None, ''),
+ (230, 'IDM_EDIT_DUPLICATE_LINE', 'Duplicate Line\tCtrl+J', wx.ITEM_NORMAL, 'OnEditDuplicateLine', 'Duplicates current line'),
+ (240, 'IDM_EDIT_DUPLICATE_CHAR', 'Duplicate Char\tCtrl+M', wx.ITEM_NORMAL, 'OnEditDuplicateChar', 'Copies a character from previous line'),
+ ]),
+ (215,
+ [
+ (100, 'IDM_EDIT_SELECTION_SELECTALL', 'Select All\tCtrl+A', wx.ITEM_NORMAL, 'DoSTCBuildIn', 'Select all text of the document'),
     ]),
 ]
 Mixin.setMixin('mainframe', 'menulist', menulist)
@@ -80,6 +91,27 @@
         win.document.CmdKeyE​xecute(wx.stc.STC_CM​D_COPY)
     elif eid == win.IDM_EDIT_PASTE:
         win.document.CmdKeyE​xecute(wx.stc.STC_CM​D_PASTE)
- elif eid == win.IDM_SELECT_ALL:
+ elif eid == win.IDM_EDIT_SELECTI​ON_SELECTALL:
         win.document.CmdKeyE​xecute(wx.stc.STC_CM​D_SELECTALL)
 Mixin.setMixin('mainframe', 'DoSTCBuildIn', DoSTCBuildIn)
+
+def OnEditDuplicateLine(win, event):
+ c = win.document.GetCurrentLine()
+ text = win.document.GetLine(c)
+ pos = win.document.GetLine​EndPosition(c)
+ win.document.InsertText(pos, win.document.getEOLChar() + text)
+ win.document.GotoPos​(win.document.GetLin​eEndPosition(c + 1))
+Mixin.setMixin('mainframe', 'OnEditDuplicateLine', OnEditDuplicateLine)
+
+def OnEditDuplicateChar(win, event):
+ c = win.document.GetCurrentLine()
+ if c > 0:
+ text, pos = win.document.GetCurLine()
+ lasttext = win.document.GetLine(c - 1)
+ try:
+ ch = lasttext[pos]
+ win.document.InsertT​ext(win.document.Get​CurrentPos(), ch)
+ win.document.GotoPos​(win.document.GetCur​rentPos() + 1)
+ except:
+ pass
+Mixin.setMixin('mainframe', 'OnEditDuplicateChar', OnEditDuplicateChar)

File [added]: DClickCloseFile.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/mixins/D​ClickCloseFile.py?re​v=1.1&content-ty​pe=text/vnd.viewcvs-​markup
Added lines: 31
---------------
import Mixin
import wx

def pref_init(pref):
    pref.dclick_close_file = True
Mixin.setPlugin('preference', 'init', pref_init)

preflist = [
    ('generic', 130, 'check', 'dclick_close_file', 'Double click will close the selected document:', None)
]
Mixin.setMixin('preference', 'preflist', preflist)

def savepreference(mainframe, pref):
    if pref.dclick_close_file:
        wx.EVT_LEFT_DCLICK(m​ainframe.editctrl, mainframe.editctrl.OnDClick)
    else:
        wx.EVT_LEFT_DCLICK(m​ainframe.editctrl, None)
Mixin.setPlugin('prefdialog', 'savepreference', savepreference)

def OnDClick(win, event):
    win.mainframe.CloseF​ile(win.document)
    if len(win.list) == 0:
        win.new()
Mixin.setMixin('editctrl', 'OnDClick', OnDClick)

def init(win):
    if win.pref.dclick_close_file:
        wx.EVT_LEFT_DCLICK(win, win.OnDClick)
    else:
        wx.EVT_LEFT_DCLICK(win, None)
Mixin.setPlugin('editctrl', 'init', init)

File [changed]: Editor.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/mixins/E​ditor.py?r1=1.4&​r2=1.5
Delta lines: +7 -3
-------------------
--- Editor.py 15 May 2004 06:20:47 -0000 1.4
+++ Editor.py 15 May 2004 15:11:32 -0000 1.5
@@ -20,6 +20,7 @@
         self.pref = self.mainframe.pref
         self.fileid = self.fid
         Editor.fid += 1
+ self.mwidth = 0
 
         self.callplugin('beforeinit', self)
 
@@ -58,7 +59,10 @@
 
     def setLineNumberMargin(self):
         lines = self.GetLineCount() #get # of lines, ensure text is loaded first!
- width = self.TextWidth(wx.st​c.STC_STYLE_LINENUMB​ER, str(9999)+' ')
+ mwidth = len(str(lines))
+ if self.mwidth < mwidth:
+ self.mwidth = mwidth
+ width = self.TextWidth(wx.st​c.STC_STYLE_LINENUMB​ER, 'O'*(self.mwidth))
         self.SetMarginType(1, wx.stc.STC_MARGIN_NUMBER )
         self.SetMarginWidth(1, width)
 

File [added]: Format.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/mixins/F​ormat.py?rev=1.1​&content-type=text/v​nd.viewcvs-markup
Added lines: 42
---------------
import Mixin
import wx
import wx.stc

menulist = [ (200,
    [
        (250, 'IDM_EDIT_FORMAT', 'Format', wx.ITEM_NORMAL, None, ''),
    ]),
    (250,
    [
        (100, 'IDM_EDIT_FORMAT_CHOP', 'Chop Line Ending Space', wx.ITEM_NORMAL, 'OnEditFormatChop', 'Chop line ending space'),
        (110, 'IDM_EDIT_FORMAT_SPACETOTAB', 'Convert Leading Space To Tab', wx.ITEM_NORMAL, 'OnEditFormatSpaceToTab', 'Convert all document or selected lines leading space to tab'),
        (120, 'IDM_EDIT_FORMAT_TABTOSPACE', 'Convert Leading Tab To Space', wx.ITEM_NORMAL, 'OnEditFormatTabToSpace', 'Convert all document or selected lines leading tab to space'),
        (130, '', '-', wx.ITEM_SEPARATOR, None, ''),
        (140, 'IDM_EDIT_FORMAT_INDENT', 'Indent\tCtrl+I', wx.ITEM_NORMAL, 'OnEditFormatIndent', 'Indent'),
        (150, 'IDM_EDIT_FORMAT_UNINDENT', 'Unindent\tCtrl+Shift+I', wx.ITEM_NORMAL, 'OnEditFormatIndent', 'Indent'),
        (160, '', '-', wx.ITEM_SEPARATOR, None, ''),
        (170, 'IDM_EDIT_FORMAT_COMMENT', 'Comment', wx.ITEM_NORMAL, 'OnEditFormatComment', 'Comment current line or selected lines'),
        (180, 'IDM_EDIT_FORMAT_UNCOMMENT', 'Uncomment', wx.ITEM_NORMAL, 'OnEditFormatUncomment', 'Uncomment current line or selected lines'),
    ]),
]
Mixin.setMixin('mainframe', 'menulist', menulist)

popmenulist = [ (0, #parent menu id
    [
        (180, '', '-', wx.ITEM_SEPARATOR, None, ''),
        (190, 'IDPM_FORMAT', 'Format', wx.ITEM_NORMAL, None, ''),
    ]),
    (190,
    [
        (190, 'IDPM_FORMAT_CHOP', 'Chop Line Ending Space', wx.ITEM_NORMAL, 'OnFormatChop', 'Chop line ending space'),
        (200, 'IDPM_FORMAT_SPACETOTAB', 'Convert Leading Space To Tab', wx.ITEM_NORMAL, 'OnFormatSpaceToTab', 'Convert all document or selected lines leading space to tab'),
        (210, 'IDPM_FORMAT_TABTOSPACE', 'Convert Leading Tab To Space', wx.ITEM_NORMAL, 'OnFormatTabToSpace', 'Convert all document or selected lines leading tab to space'),
        (220, '', '-', wx.ITEM_SEPARATOR, None, ''),
        (230, 'IDPM_FORMAT_INDENT', 'Indent\tCtrl+I', wx.ITEM_NORMAL, 'OnFormatIndent', 'Indent'),
        (240, 'IDPM_FORMAT_UNINDENT', 'Unindent\tCtrl+Shift+I', wx.ITEM_NORMAL, 'OnFormatIndent', 'Indent'),
        (250, '', '-', wx.ITEM_SEPARATOR, None, ''),
        (260, 'IDPM_FORMAT_COMMENT', 'Comment', wx.ITEM_NORMAL, 'OnFormatComment', 'Comment current line or selected lines'),
        (270, 'IDPM_FORMAT_UNCOMMENT', 'Uncomment', wx.ITEM_NORMAL, 'OnFormatUncomment', 'Uncomment current line or selected lines'),
    ]),
]
Mixin.setMixin('editor', 'popmenulist', popmenulist)

File [changed]: OnModified.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/mixins/O​nModified.py?r1=1.5​&r2=1.6
Delta lines: +1 -0
-------------------
--- OnModified.py 15 May 2004 06:20:47 -0000 1.5
+++ OnModified.py 15 May 2004 15:11:32 -0000 1.6
@@ -11,5 +11,6 @@
     else:
         win.SetSavePoint()
         win.editctrl.showTitle(win)
+ win.setLineNumberMargin()
     win.callplugin('onmodified', win)
 Mixin.setMixin('editor', 'OnModified', OnModified)

File [added]: OnUpdateUI.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/mixins/O​nUpdateUI.py?rev=1.1​&content-type=te​xt/vnd.viewcvs-marku​p
Added lines: 49
---------------
"""Process OnUpdateUI event"""

import Mixin
import wx

def init(win):
    wx.EVT_UPDATE_UI(win, win.IDM_EDIT_CUT, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDM_EDIT_COPY, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDM_EDIT_PASTE, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDM_EDIT_UNDO, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDM_EDIT_REDO, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDM_FILE_SAVE, win.OnUpdateUI)
Mixin.setPlugin('mainframe', 'init', init)

def OnUpdateUI(win, event):
    eid = event.GetId()
    if eid in [win.IDM_EDIT_CUT, win.IDM_EDIT_COPY]:
        event.Enable(len(win​.document.GetSelecte​dText()) > 0)
    elif eid == win.IDM_EDIT_PASTE:
        event.Enable(win.doc​ument.CanPaste())
    elif eid == win.IDM_EDIT_UNDO:
        event.Enable(win.doc​ument.CanUndo())
    elif eid == win.IDM_EDIT_REDO:
        event.Enable(win.doc​ument.CanRedo())
    elif eid == win.IDM_FILE_SAVE:
        event.Enable(win.doc​ument.GetModify())
    win.callplugin('onupdateui', win, event)
Mixin.setMixin('mainframe', 'OnUpdateUI', OnUpdateUI)

def init(win):
    wx.EVT_UPDATE_UI(win, win.IDPM_CUT, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDPM_COPY, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDPM_PASTE, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDPM_UNDO, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDPM_REDO, win.OnUpdateUI)
Mixin.setPlugin('editor', 'init', init)

def OnUpdateUI(win, event):
    eid = event.GetId()
    if eid in [win.IDPM_CUT, win.IDPM_COPY]:
        event.Enable(len(win​.GetSelectedText()) > 0)
    elif eid == win.IDPM_PASTE:
        event.Enable(win.CanPaste())
    elif eid == win.IDPM_UNDO:
        event.Enable(win.CanUndo())
    elif eid == win.IDPM_REDO:
        event.Enable(win.CanRedo())
    win.callplugin('onupdateui', win, event)
Mixin.setMixin('editor', 'OnUpdateUI', OnUpdateUI)

File [changed]: Search.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/mixins/S​earch.py?r1=1.5&​r2=1.6
Delta lines: +2 -2
-------------------
--- Search.py 15 May 2004 06:20:47 -0000 1.5
+++ Search.py 15 May 2004 15:11:32 -0000 1.6
@@ -28,8 +28,8 @@
 Mixin.setMixin('mainframe', 'toollist', toollist)
 
 toolbaritems = {
- 'find':('IDM_SEARCH_FIND', 'images/find.gif', 'find', 'Find text', 'OnSearchFind'),
- 'replace':('IDM_SEAR​CH_REPLACE', 'images/replace.gif', 'replace', 'Find and replace text', 'OnSearchReplace'),
+ 'find':(wx.ITEM_NORMAL, 'IDM_SEARCH_FIND', 'images/find.gif', 'find', 'Find text', 'OnSearchFind'),
+ 'replace':(wx.ITEM_NORMAL, 'IDM_SEARCH_REPLACE', 'images/replace.gif', 'replace', 'Find and replace text', 'OnSearchReplace'),
 }
 Mixin.setMixin('mainframe', 'toolbaritems', toolbaritems)
 

File [added]: SetScrollWidth.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/mixins/S​etScrollWidth.py?rev​=1.1&content-typ​e=text/vnd.viewcvs-m​arkup
Added lines: 30
---------------
import Mixin
import wx
import wx.stc

def init(win):
    win.SetScrollWidth(1)
Mixin.setPlugin('editor', 'beforeinit', init)

def onmodified(win):
    if win.GetWrapMode() == wx.stc.STC_WRAP_NONE:
        setWidth(win, win.GetCurLine()[0])
Mixin.setPlugin('editor', 'onmodified', onmodified)

def openfiletext(win, stext):
    if win.GetWrapMode() == wx.stc.STC_WRAP_NONE:
        lines = stext[0].splitlines()
        lens = [len(text) for text in lines]
        maxlen = max(lens)
        line = lines[lens.index(maxlen)]
        setWidth(win, line)
Mixin.setPlugin('editor', 'openfiletext', openfiletext)

def setWidth(win, text):
    if win.GetWrapMode() == wx.stc.STC_WRAP_NONE:
        ll = win.TextWidth(wx.stc​.STC_STYLE_DEFAULT, "O")*8
        current_width = win.GetScrollWidth()
        line = text.expandtabs(win.​GetTabWidth())
        actual_width = win.TextWidth(wx.stc​.STC_STYLE_DEFAULT, line)
        if (current_width < actual_width):
            win.SetScrollWidth(actual_width + ll)

File [changed]: Toolbar.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/mixins/T​oolbar.py?r1=1.2​&r2=1.3
Delta lines: +9 -9
-------------------
--- Toolbar.py 15 May 2004 02:20:56 -0000 1.2
+++ Toolbar.py 15 May 2004 15:11:32 -0000 1.3
@@ -24,15 +24,15 @@
 
 #order, IDname, imagefile, short text, long text, func
 toolbaritems = {
- 'new':('IDM_FILE_NEW', 'images/new.gif', 'new', 'New document', 'OnFileNew'),
- 'open':('IDM_FILE_OPEN', 'images/open.gif', 'open', 'Open document', 'OnFileOpen'),
- 'save':('IDM_FILE_SAVE', 'images/save.gif', 'save', 'Save document', 'OnFileSave'),
- 'cut':('IDM_EDIT_CUT', 'images/cut.gif', 'cut', 'Cut selected text to clipboard', 'DoSTCBuildIn'),
- 'copy':('IDM_EDIT_COPY', 'images/copy.gif', 'copy', 'Copy selected text clipboard', 'DoSTCBuildIn'),
- 'paste':('IDM_EDIT_PASTE', 'images/paste.gif', 'paste', 'Paste text from clipboard', 'DoSTCBuildIn'),
- 'undo':('IDM_EDIT_UNDO', 'images/undo.gif', 'undo', 'Undo last command', 'OnEditUndo'),
- 'redo':('IDM_EDIT_REDO', 'images/redo.gif', 'redo', 'Redo last command', 'OnEditRedo'),
- 'preference':('IDM_O​PTION_PREFERENCE', 'images/prop.gif', 'preference', 'Preferences of software', 'OnOptionPreference'),
+ 'new':(wx.ITEM_NORMAL, 'IDM_FILE_NEW', 'images/new.gif', 'new', 'New document', 'OnFileNew'),
+ 'open':(wx.ITEM_NORMAL, 'IDM_FILE_OPEN', 'images/open.gif', 'open', 'Open document', 'OnFileOpen'),
+ 'save':(wx.ITEM_NORMAL, 'IDM_FILE_SAVE', 'images/save.gif', 'save', 'Save document', 'OnFileSave'),
+ 'cut':(wx.ITEM_NORMAL, 'IDM_EDIT_CUT', 'images/cut.gif', 'cut', 'Cut selected text to clipboard', 'DoSTCBuildIn'),
+ 'copy':(wx.ITEM_NORMAL, 'IDM_EDIT_COPY', 'images/copy.gif', 'copy', 'Copy selected text clipboard', 'DoSTCBuildIn'),
+ 'paste':(wx.ITEM_NORMAL, 'IDM_EDIT_PASTE', 'images/paste.gif', 'paste', 'Paste text from clipboard', 'DoSTCBuildIn'),
+ 'undo':(wx.ITEM_NORMAL, 'IDM_EDIT_UNDO', 'images/undo.gif', 'undo', 'Undo last command', 'OnEditUndo'),
+ 'redo':(wx.ITEM_NORMAL, 'IDM_EDIT_REDO', 'images/redo.gif', 'redo', 'Redo last command', 'OnEditRedo'),
+ 'preference':(wx.ITEM_NORMAL, 'IDM_OPTION_PREFERENCE', 'images/prop.gif', 'preference', 'Preferences of software', 'OnOptionPreference'),
 }
 Mixin.setMixin('mainframe', 'toolbaritems', toolbaritems)
 

File [added]: View.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/mixins/V​iew.py?rev=1.1&c​ontent-type=text/vnd​.viewcvs-markup
Added lines: 50
---------------
import Mixin
import wx
import wx.stc

menulist = [ (0,
    [
        (300, 'IDM_VIEW', 'View', wx.ITEM_NORMAL, None, ''),
    ]),
    (300, #parent menu id
    [
        (305, 'IDM_VIEW_WINDOW', 'Toolbar And Windows', wx.ITEM_NORMAL, 'OnViewWindow', 'View of toolar and window'),
        (310, '', '-', wx.ITEM_SEPARATOR, '', ''),
        (315, 'IDM_VIEW_TAB', 'Tab And White Space\tCtrl+Shift+I', wx.ITEM_CHECK, 'OnViewTab', 'Toggle view of tab and white space'),
    ]),
]
Mixin.setMixin('mainframe', 'menulist', menulist)

def init(win):
    wx.EVT_UPDATE_UI(win, win.IDM_VIEW_TAB, win.OnUpdateUI)
Mixin.setPlugin('mainframe', 'init', init)

def OnViewTab(win, event):
    stat = win.document.GetView​WhiteSpace()
    if stat == wx.stc.STC_WS_INVISIBLE:
        win.document.SetView​WhiteSpace(wx.stc.ST​C_WS_VISIBLEALWAYS)
    elif stat == wx.stc.STC_WS_VISIBLEALWAYS:
        win.document.SetView​WhiteSpace(wx.stc.ST​C_WS_INVISIBLE)
Mixin.setMixin('mainframe', 'OnViewTab', OnViewTab)

def onupdateui(win, event):
    eid = event.GetId()
    if eid == win.IDM_VIEW_TAB:
        stat = win.document.GetView​WhiteSpace()
        if stat == wx.stc.STC_WS_INVISIBLE:
            event.Check(False)
        elif stat == wx.stc.STC_WS_VISIBLEALWAYS:
            event.Check(True)
Mixin.setPlugin('mainframe', 'onupdateui', onupdateui)

toollist = [
    (800, '|'),
    (810, 'viewtab'),
]
Mixin.setMixin('mainframe', 'toollist', toollist)

#order, IDname, imagefile, short text, long text, func
toolbaritems = {
    'viewtab':(wx.ITEM_CHECK, 'IDM_VIEW_TAB', 'images/format.gif', 'toggle white space', 'Toggle view of tab and white space', 'OnViewTab'),
}
Mixin.setMixin('mainframe', 'toolbaritems', toolbaritems)

File [changed]: __init__.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/mixins/_​_init__.py?r1=1.6​&r2=1.7
Delta lines: +2 -0
-------------------
--- __init__.py 15 May 2004 06:20:47 -0000 1.6
+++ __init__.py 15 May 2004 15:11:32 -0000 1.7
@@ -18,4 +18,6 @@
     'DClickCloseFile',
     'OnUpdateUI',
     'SetScrollWidth',
+ 'View',
+ 'Format',
 ]

Directory: /newedit/src/modules/
====================​============

File [changed]: Accelerator.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/modules/​Accelerator.py?r1=1.​1&r2=1.2
Delta lines: +8 -8
-------------------
--- Accelerator.py 12 May 2004 07:04:19 -0000 1.1
+++ Accelerator.py 15 May 2004 15:11:32 -0000 1.2
@@ -9,9 +9,9 @@
 'RETURN' :wx.WXK_RETURN,
 'ESCAPE' :wx.WXK_ESCAPE,
 'SPACE' :wx.WXK_SPACE,
-'DELETE' :wx.WXK_DELETE,
-'PRIOR' :wx.WXK_PRIOR,
-'NEXT' :wx.WXK_NEXT,
+'DEL' :wx.WXK_DELETE,
+'PGUP' :wx.WXK_PAGEUP,
+'PGDN' :wx.WXK_PAGEDOWN,
 'END' :wx.WXK_END,
 'HOME' :wx.WXK_HOME,
 'LEFT' :wx.WXK_LEFT,
@@ -19,7 +19,7 @@
 'RIGHT' :wx.WXK_RIGHT,
 'DOWN' :wx.WXK_DOWN,
 'PRINT' :wx.WXK_PRINT,
-'INSERT' :wx.WXK_INSERT,
+'INS' :wx.WXK_INSERT,
 'HELP' :wx.WXK_HELP,
 'NUMPAD0' :wx.WXK_NUMPAD0,
 'NUMPAD1' :wx.WXK_NUMPAD1,
@@ -33,9 +33,9 @@
 'NUMPAD9' :wx.WXK_NUMPAD9,
 'ADD' :wx.WXK_ADD,
 'SEPARATOR' :wx.WXK_SEPARATOR,
-'SUBTRACT' :wx.WXK_SUBTRACT,
-'DECIMAL' :wx.WXK_DECIMAL,
-'DIVIDE' :wx.WXK_DIVIDE,
+'-' :wx.WXK_SUBTRACT,
+'.' :wx.WXK_DECIMAL,
+'/' :wx.WXK_DIVIDE,
 'F1' :wx.WXK_F1,
 'F2' :wx.WXK_F2,
 'F3' :wx.WXK_F3,
@@ -69,7 +69,7 @@
 
     for keys, idname in acceleratorlist:
         f=wx.ACCEL_NORMAL
- for k in re.split('[\+-]', keys):
+ for k in keys.split('+'):
             uk = k.upper()
             if uk == 'CTRL':
                 f |= wx.ACCEL_CTRL

File [changed]: Mixin.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/modules/​Mixin.py?r1=1.2&​r2=1.3
Delta lines: +4 -4
-------------------
--- Mixin.py 15 May 2004 02:20:57 -0000 1.2
+++ Mixin.py 15 May 2004 15:11:32 -0000 1.3
@@ -34,20 +34,20 @@
 
     def callplugin(self, name, *argv, **argkv):
         if not self.__plugins__.has_key(name):
- debugput('[Mixin] The plugin [%s] has not been implemented yet!' % name)
+ #debugput('[Mixin] The plugin [%s] has not been implemented yet!' % name)
             return
 
         for f in self.__plugins__[name]:
- debugput("[Mixin] Call plugin [%s]" % name)
+ #debugput("[Mixin] Call plugin [%s]" % name)
             f(*argv, **argkv)
 
     def execplugin(self, name, *argv, **argkv):
         if not self.__plugins__.has_key(name):
- debugput('[Mixin] The plugin [%s] has not been implemented yet!' % name)
+ #debugput('[Mixin] The plugin [%s] has not been implemented yet!' % name)
             return None
 
         if len(self.__plugins__​[name])>1:
- debugput('[Mixin] There should be only one plug-in [%s]!' % name)
+ #debugput('[Mixin] There should be only one plug-in [%s]!' % name)
             return None
 
         f = self.__plugins__[name][0]

File [changed]: maketoolbar.py
Url: http://newedit.tigri​s.org/source/browse/​newedit/src/modules/​maketoolbar.py?r1=1.​1&r2=1.2
Delta lines: +11 -3
--------------------
--- maketoolbar.py 12 May 2004 07:04:19 -0000 1.1
+++ maketoolbar.py 15 May 2004 15:11:32 -0000 1.2
@@ -4,6 +4,7 @@
 import os.path
 
 class EUnknowImageType(Exception): pass
+class EUnknowStyleType(Exception): pass
 
 def getimagetype(imagefile):
     ext = os.path.splitext(ima​gefile.lower())[1]
@@ -24,7 +25,7 @@
     win.toolbar = win.CreateToolBar(wx​.TB_HORIZONTAL | wx.NO_BORDER | wx.TB_FLAT | wx.TB_TEXT)
 
     #judge image size by the first item of the toolbar item list
- imagefile = toolbaritems.values()[0][1]
+ imagefile = toolbaritems.values()[0][2]
     image = wx.Image(imagefile, getimagetype(imagefile))
     size = wx.Size(image.GetWidth(), image.GetHeight())
     win.toolbar.SetToolB​itmapSize(size)
@@ -34,9 +35,16 @@
         if name == '|':
             win.toolbar.AddSeparator()
         else:
- idname, imagefile, shorttext, longtext, func = toolbaritems[name]
+ style, idname, imagefile, shorttext, longtext, func = toolbaritems[name]
             id = Id.makeid(win, idname)
+ if style == wx.ITEM_NORMAL:
             win.toolbar.AddSimpleTool(id, wx.Image(imagefile, getimagetype(imagefi​le)).ConvertToBitmap​(), shorttext, longtext)
+ elif style == wx.ITEM_CHECK:
+ win.toolbar.AddCheckTool(id, wx.Image(imagefile, getimagetype(imagefi​le)).ConvertToBitmap​(), shortHelp=shorttext, longHelp=longtext)
+ elif style == wx.ITEM_RADIO:
+ win.toolbar.AddRadioTool(id, wx.Image(imagefile, getimagetype(imagefi​le)).ConvertToBitmap​(), shortHelp=shorttext, longHelp=longtext)
+ else:
+ raise EUnknowStyleType
             if func:
                 try:
                     f = getattr(win, func)




--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe@newe​dit.tigris.org
For additional commands, e-mail: cvs-help at newedit dot tigris dot org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /newedit/src/, /newedit/src/mixins/, /newedit/src/modules/ limodou limodou 2004-05-15 08:11:37 PDT
Messages per page: